在C当前微秒时间? [英] Current microsecond time in C?
本文介绍了在C当前微秒时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何打印在Unix平台上用C电流微秒的时间?
How can I print current microseconds time in C on Unix platform?
推荐答案
在Linux和BSD系统,你可以使用函数gettimeofday()
功能。这种填充一个的timeval
结构具有以来的时代和微秒字段秒的字段。此功能去precated。更高的分辨率 clock_gettime()是偏爱的替代品,但Mac OS X中没有实现它。我不知道Windows是否实现了其中任一。
In Linux and BSDs, you can use the gettimeofday()
function. This populates a timeval
struct which has a field for seconds since the epoch and a field for microseconds. This function is deprecated. The higher resolution clock_gettime() is the favored replacement, however Mac OS X does not implement it. I'm not sure if Windows implements either of these.
这篇关于在C当前微秒时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文