struct timeval tv;
char buf[64];
gettimeofday(&tv, NULL);
strftime(buf, sizeof(buf)-1, "%Y-%m-%d %H:%M:%S", localtime(&tv.tv_sec));
fprintf(stderr, "%s.%03d: ", buf, (int)(tv.tv_usec / 1000));
linux C++ 获取当前时间,以标准时间“年-月-日 时:分:秒”的形式输出,且秒后边跟小数精确到毫秒
最新推荐文章于 2024-11-04 23:41:18 发布
297

被折叠的 条评论
为什么被折叠?



