Puzzled with Time Server conversion problems?

Bill Eldridge bill at hk.rfa.org
Wed Oct 6 07:31:49 EDT 1999


Benjamin Schollnick wrote:
> 
> On Tue, 5 Oct 1999 08:51:55, Bill Eldridge <bill at hk.rfa.org> wrote:
> 
> > >>> time.localtime(3155550800.0)
> > (1901, 12, 14, 4, 22, 28, 5, 348, 0)
> > >>> time.localtime(315555080.0)
> > (1980, 1, 1, 14, 11, 20, 1, 1, 0)
> >
> > 1970-1976 was about 190 million seconds, so 1976-1980 should
> > be less than double (380 million seconds), not 3.2 billion seconds.
> 
> Eh?
> 
> Bill, I've been staring at this problem on and off for days.  I
> certainly
> could have made a typo in the comment(s), but either way I worked
> around it with a manual calculation....

> python GMTIME calcs                                                     RFC 868
> (Base 1970, Jan 1)                                                        (Base Jan 1, 1900)
> Jan 1, 1970     -              18,000.0                                         2,208,988,800
> Jan 1, 1976     -    189,320,400.0                                              2,398,291,200
> Jan 1, 1980     - 3,155,550,800.0                                       2,524,421,600
> 
> I don't see how python's Jan 1, 1980 calcuation can exceed the RFC's
> calculation,

Your time of 3,155,550,800 is 10 times the actual number of seconds
from 1970 to 1980, which is 315,555,080.0, which seems to be why
you were distrusting Python.  315,555,080 is LESS than the RFC
2524421600.


I also get 2,209,161,600 from Jan 1, 1900 to 1970 instead
of 2,208,988,800; and 315532800 seconds for Unix GMT Jan 1, 1980 instead
of 3155550800; and 2524694400.0 instead of 2,524,421,600 for RFC's 1980.

(note that time.mktime returns local time, while time.time returns UTC)
--
Bill Eldridge
Radio Free Asia
bill at hk.rfa.org




More information about the Python-list mailing list