time_t SystemTimeToTime_t( const SYSTEMTIME& st ) { tm temptm = {st.wSecond, st.wMinute, st.wHour, st.wDay, st.wMonth - 1, st.wYear - 1900, st.wDayOfWeek, 0, 0}; return mktime(&temptm); } SYSTEMTIME Time_tToSystemTime(time_t t) { //tm temptm = *localtime_s(&t); tm temptm; localtime_s(&temptm,&t); SYSTEMTIME st = {1900 + temptm.tm_year, 1 + temptm.tm_mon, temptm.tm_wday, temptm.tm_mday, temptm.tm_hour, temptm.tm_min, temptm.tm_sec, 0}; return st; }
SYSTEMTIME 与 time_t 互转函数,码迷,mamicode.com
原文地址:http://blog.csdn.net/timothy721/article/details/24715411