#include "time.h"
/////////////////////////////////////////
// VC2010
void getTimeString1()
{
time_t _t;
::time(&_t);
struct tm _tm;
::localtime_s(&_tm, &_t);
TRACE(L"%04d%02d%02d_%02d_%02d_%02d",
_tm.tm_year + 1900, _tm.tm_mon + 1, tm.tm_mday,
_tm.tm_hour, _tm.tm_min, _tm.tm_sec);
}
/////////////////////////////////////////
// VC6
void getTimeString2()
{
time_t _t;
::time(&_t);
struct tm* _tm = ::localtime(&_t);
TRACE(L"%04d%02d%02d_%02d_%02d_%02d",
_tm->tm_year + 1900, _tm->tm_mon + 1, tm->tm_mday,
_tm->tm_hour, _tm->tm_min, _tm->tm_sec);
}
/////////////////////////////////////////
void getTimeString3()
{
SYSTEMTIME stCurrTime;
::GetLocalTime( &stCurrTime );
TRACE( L"%04u%02u%02u_%02u%02u%02u_%03u",
stCurrTime.wYear,
stCurrTime.wMonth,
stCurrTime.wDay,
stCurrTime.wHour,
stCurrTime.wMinute,
stCurrTime.wSecond,
stCurrTime.wMilliseconds);
}
最終更新:2012年04月19日 10:21