c++ 时间戳

#include <stdio.h>
#include <time.h>

int main(void)
{
time_t tick;
struct tm tm;
char s[100];

tick = time(NULL);
tm = *localtime(&tick);
strftime(s, sizeof(s), "%Y-%m-%d %H:%M:%S", &tm);
printf("%d: %s\n", (int)tick, s);

return 0;
}


http://blog.csdn.net/e295166319/article/details/72846760

posted on 2017-12-13 17:59  lydstory  阅读(195)  评论(0编辑  收藏  举报

导航