为什么python时间有61秒 [英] Why python time has 61 seconds
问题描述
有没有人注意到Python datetime中秒的间隔是[00,61]请参阅本页底部的表格.http://docs.python.org/library/datetime.html#strftime-strptime-behavior
Did anybody notice that the interval of second in Python datetime is [00,61] see the table in the bottom of this page. http://docs.python.org/library/datetime.html#strftime-strptime-behavior
为什么?
推荐答案
答案在页面下方:
范围真的是0到61;根据 Posix 标准,这个占闰秒和(非常罕见的)双闰秒.这time 模块可能会产生并确实接受闰秒,因为它是基于在 Posix 标准上,但 datetime 模块不接受跳跃strptime() 输入中的秒数也不会在 strftime() 中产生它们输出.
The range really is 0 to 61; according to the Posix standard this accounts for leap seconds and the (very rare) double leap seconds. The time module may produce and does accept leap seconds since it is based on the Posix standard, but the datetime module does not accept leap seconds in strptime() input nor will it produce them in strftime() output.
这确实是一个有趣的行为.
This is an interesting behavior, indeed.
这篇关于为什么python时间有61秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!