Skip to content Skip to sidebar Skip to footer

Why Python Time Has 61 Seconds

Did anybody notice that the interval of second in Python datetime is [00,61] see the table on this page. https://docs.python.org/3/library/time.html#time.strftime Why?

Solution 1:

The answer is on the same page in footnote (2):

The range really is 0 to 61; value 60 is valid in timestamps representing leap seconds and value 61 is supported for historical reasons.

The "historical reasons" are described in https://bugs.python.org/issue2568.

Solution 2:

There is no such thing as a double leap second. There cannot be 62 seconds in a minute. 59, yes. 60, yes. 61, yes. 62, no.

http://www.monkey.org/openbsd/archive2/tech/199905/msg00031.html

Solution 3:

Probably to account for leap seconds.

Solution 4:

When you have to add leap second it will be helpful to calculate that. You can search on net for leap second. Due to that second range in python is 0-61.

Solution 5:

Leap seconds.

It has been the case that there have been 62 seconds in a minute in the past.

It adjusts for the world spinning slower.

Part of this is down to tides. The energy for the tides comes from the rotation of the earth and moon. The result is that the world slows down.

If global warming takes place the oceans get hotter and expand. That is like a skater throwing their arms out, and the spin slows down. That hasn't taken place. The measurement of ocean levels doesn't agree with the rotation measurements. It's likely to be down to problems with the earth's surface moving, which is far larger than the sea level rise.

Post a Comment for "Why Python Time Has 61 Seconds"