simpler increment of time values?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Jul 5 11:19:35 EDT 2012


On Thu, 05 Jul 2012 23:56:37 +1000, Chris Angelico wrote:

> (The "magic number" 86400 is a well-known number, being seconds in a
> day. 

Does that include leap seconds?


> Feel free to replace it with 24*60*60 if it makes you feel better;
> I'm pretty sure Python will translate it into a constant at parse time.
> Or alternatively, have a module-level constant SECONDS_IN_A_DAY = 86400,
> in case that number should ever change.)

"In case"?

The number of seconds in a day (true solar day) varies by between 13 and 
30 seconds depending on the time of the year and the position of the sun.

The mean solar day fluctuates randomly by about 5ms due to friction 
between the core and the mantle; it is also systematically slowing due to 
tidal friction. The 2004 Indian Ocean earthquake reduced the length of a 
day by about 3ms; the 2011 Japan earthquake slowed it down by about 2ms. 
Apart from these random changes, there are systematic changes of the 
order of 1ms per year, so in a mere thousand years, the length of the 
mean solar day will be about a second longer.

Imagine how much extra work we'll be able to get done!

The stellar day (Earth's rotational period relative to the distant stars) 
is slightly more than 86164.098 seconds; the sidereal day is slightly 
more than 86164.090 seconds. Both are approximately 3 minutes 56 seconds 
shorter than the mean solar day.



-- 
Steven



More information about the Python-list mailing list