time.time()返回基础库返回的值。Python使用time(..)或{}(取决于系统上可用的内容)。在
在这两种情况下,都会返回UTC。E、 g组:The time() function shall return the value of time in seconds since the Epoch
在Matt的一个有效注释之后,我必须添加epoch的定义,它清楚地声明{}返回UTC时间。在Epoch:
Historically, the origin of UNIX system time was referred to as
"00:00:00 GMT, January 1, 1970". Greenwich Mean Time is actually not a
term acknowledged by the international standards community; therefore,
this term, "Epoch", is used to abbreviate the reference to the actual
standard, Coordinated Universal Time.
要验证历元是相同的,请检查:import time
a = time.gmtime(secs=0)
# time.struct_time(tm_year=2015, tm_mon=9, tm_mday=9, tm_hour=1, tm_min=3, tm_sec=28, tm_wday=2, tm_yday=252, tm_isdst=0)
b = time.localtime(secs=0)
# time.struct_time(tm_year=2015, tm_mon=9, tm_mday=9, tm_hour=3, tm_min=1, tm_sec=28, tm_wday=2, tm_yday=252, tm_isdst=1)
如果参数secs为0,两个函数都使用从time.time()返回的值。在我的例子中,tm_isdst对于localtime设置为true,对于gmtime设置为false(它表示自epoch以来的时间)。在
编辑:你从哪里读到这个值会变小?