【问题标题】:how can I show the elapsed time in hh:mm:ss:SSS format in C如何在 C 中以 hh:mm:ss:SSS 格式显示经过的时间
【发布时间】:2013-05-28 13:52:21
【问题描述】:

我会做一些处理。
然后我想在 C 中以hh:mm:ss:SSS 格式显示这个处理时间。
如果有人知道,可以解释一下吗?
我正在 Visual Studio 2008 中编写 c 代码。
提前致谢。

例如。 开始时间。 做一些过程。 时间结束。 经过时间 = 结束时间 - 开始时间。 然后我想以hh:mm:ss:SSS 格式显示这个经过的时间。

【问题讨论】:

标签: c time-format


【解决方案1】:
time_t t = time( 0 ); 
char tmp[64]; 
strftime( tmp, sizeof(tmp), "%H:%M:%S", localtime(&t) ); 

我不知道如何获得 SSS,所以我希望这能给你一些建议。

【讨论】:

    猜你喜欢
    • 2011-10-06
    • 2012-02-14
    • 2017-08-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多