#include <stdio.h> #include <time.h> int main(){ SYSTEMTIME lpSysTime; GetLocalTime(&lpSysTime); tm lpTime; time_t timestamp; lpTime.tm_sec = lpSysTime.wSecond; lpTime.tm_min = lpSysTime.wMinute; lpTime.tm_hour = lpSysTime.wHour; lpTime.tm_mday = lpSysTime.wDay; lpTime.tm_mon = lpSysTime.wMonth - 1; lpTime.tm_year = lpSysTime.wYear - 1900; lpTime.tm_isdst = -1; timestamp = mktime(&lpTime); printf("%d ", timestamp); }
1516856968