Is a day always 86,400 epoch seconds long?

前端 未结 4 747
一整个雨季
一整个雨季 2021-01-01 08:35

While reviewing my past answers, I noticed I\'d proposed code such as this:

import time

def dates_between(start, end):
  # muck around between the 9k+ time          


        
4条回答
  •  無奈伤痛
    2021-01-01 09:17

    Number of seconds in a day depends on time system that you use e.g., in POSIX, a day is exactly 86400 seconds by definition:

    As represented in seconds since the Epoch, each and every day shall be accounted for by exactly 86400 seconds.

    In UTC, there could be a leap second included i.e., a day can be 86401 SI seconds (and theoretically 86399 SI seconds). As of Jun 30 2015, it has happened 26 times.

    If we measure days by apparent motion of the Sun then the length of a (solar) day varies through the year by ~16 minutes from the mean.

    In turn it is different from UT1 that is also based on rotation of the Earth (mean solar time). An apparent solar day can be 20 seconds shorter or 30 seconds longer than a mean solar day. UTC is kept within 0.9 seconds of UT1 by the introduction of occasional intercalary leap seconds.

    If you define a day by local clock then it may be very chaotic due to bizarre political timezone changes. It is not correct to assume that a day may change only by an hour due to DST.

提交回复
热议问题