简体   繁体   English

两次之间的时间单位是什么?

[英]What's the time unit between two times?

import time
start = time.time()
diff = int((time.time() - start) * 1000)

The time() function 'Return the current time in seconds since the Epoch'. The time() function '返回自纪元以来的当前时间(以秒为单位)'。 When two seconds subtract, what's the time unit of diff?两秒相减时,diff的时间单位是多少?

The unit of measure is the same for both values, so the unit of measure after subtracting one value from another would still be seconds.两个值的度量单位相同,因此从一个值减去另一个值后的度量单位仍为秒。 However, since you're multiplying by 1000, the unit of measure for diff would be milliseconds (although this does not make diff any more precise).但是,由于您要乘以 1000,因此diff的度量单位将是毫秒(尽管这不会使diff更精确)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM