On Linux, the "arbitrary point in the past" from which the return value of times() is measured has varied across kernel versions. On Linux 2.4 and earlier this point is the moment the system was booted. Since Linux 2.6, this point is (2^32/HZ) - 300 (i.e., about 429 million) seconds before system boot time. This variability across kernel versions (and across UNIX implementations), combined with the fact that the returned value may overflow the range of clock_t, means that a portable application would be wise to avoid using this value. To measure changes in elapsed time, use clock_gettime(2) instead.
所有的时间都是相对于一个固定点的;这取决于操作系统来选择该点,甚至在同一操作系统的不同版本之间也是不同的。你知道吗
参见^{} documentation :
Python从
clock_t
结构返回tms_utime
、tms_stime
、tms_cutime
、tms_cstime
字段,其中第5个值是times()
调用本身的返回值,因此过去从任意点开始经过的时钟滴答数。它已经将这些值从时钟信号转换为表示秒的浮点值。你知道吗第五个值只会告诉你,在过去,以秒为单位,这个任意点在挂钟时间内有多远(或者尽可能接近操作系统测量的时间)。你知道吗
相关问题 更多 >
编程相关推荐