#include <iostream>
#include <string>
#include <System.hpp>
using namespace std;
static char *time_to_str_ms(char *outdata)
{
int len = 0;
static char buf[128] = { 0 };
memset(buf, 0, 128);
SYSTEMTIME st;
GetLocalTime(&st);
len = sprintf(buf, "%04d-%02d-%02d %02d:%02d:%02d.%03d",
st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
if(outdata)
{
memcpy(outdata, buf, len);
}
return buf;
}
int main()
{ char szBuff[50] = { 0 };
strcpy(szBuff,time_to_str_ms(NULL)); //长度23
cout<<szBuff<<endl;
system("pause");
return 0;
}