#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\n", timestamp);
}

 

1516856968

posted on 2018-01-25 13:05  你不知道的浪漫  阅读(404)  评论(0编辑  收藏  举报