问题描述
我在寻找一个相当于<$c$c>GetTickCount()$c$c>在Linux上。
I'm looking for an equivalent to GetTickCount()
on Linux.
presently我使用Python的其中presumably调用,直至<$c$c>gettimeofday()$c$c>.我担心的是时间返回(Unix纪元),可能会不稳定改变,如果时钟混乱搭配,如NTP。一个简单的过程或系统壁时,即只在一个恒定的速率就足够了积极增加
Presently I am using Python's time.time()
which presumably calls through to gettimeofday()
. My concern is that the time returned (the unix epoch), may change erratically if the clock is messed with, such as by NTP. A simple process or system wall time, that only increases positively at a constant rate would suffice.
请问用C或Python上述任何时间函数存在吗?
Does any such time function in C or Python exist?
推荐答案
您可以使用
See this question for a Python way - http://stackoverflow.com/questions/1205722/how-do-i-get-monotonic-time-durations-in-python
这篇关于相当于在Linux上的GetTickCount()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!