Velocity Reviews > Time travel

# Time travel

Lee Merrill
Guest
Posts: n/a

 11-17-2009
I'm seeing an anomaly in the python time function on March 9, 2008
(the "spring foward" time):

>>> time.mktime((2008, 3, 9, 2, 59, 59, 0, 0, -1))

1205049599.0
>>> time.mktime((2008, 3, 9, 3, 0, 0, 0, 0, -1))

1205046000.0

Does anyone have an idea as to what might cause a 4000 seconds
backwards jump on March 9th of last year? I would have expected 3600
seconds.

Thanks,
Lee

P.S. A full program demonstrating the question:

#!/usr/bin/env python

import time, datetime

d1 = datetime.datetime(2008, 3, 9, 2, 59, 0).timetuple()
#!/usr/bin/env python

import time, datetime

d1 = datetime.datetime(2008, 3, 9, 2, 59, 0).timetuple()
d2 = datetime.datetime(2008, 3, 9, 3, 0, 0).timetuple()
t1 = time.mktime(d1)
t2 = time.mktime(d2)

print t1, t2

Lee Merrill
Guest
Posts: n/a

 11-17-2009
And I can't do arithmetic, it is actually about 3600--never mind!

On Nov 17, 10:37*am, Lee Merrill <(E-Mail Removed)> wrote:
> I'm seeing an anomaly in the python time function on March 9, 2008
> (the "spring foward" time):
>
> >>> time.mktime((2008, 3, 9, 2, 59, 59, 0, 0, -1))

> 1205049599.0
> >>> time.mktime((2008, 3, 9, 3, 0, 0, 0, 0, -1))

>
> 1205046000.0
>
> Does anyone have an idea as to what might cause a 4000 seconds
> backwards jump on March 9th of last year? I would have expected 3600
> seconds.
>
> Thanks,
> Lee
>
> P.S. A full program demonstrating the question:
>
> #!/usr/bin/env python
>
> import time, datetime
>
> d1 = datetime.datetime(2008, 3, 9, 2, 59, 0).timetuple()
> #!/usr/bin/env python
>
> import time, datetime
>
> d1 = datetime.datetime(2008, 3, 9, 2, 59, 0).timetuple()
> d2 = datetime.datetime(2008, 3, 9, 3, 0, 0).timetuple()
> t1 = time.mktime(d1)
> t2 = time.mktime(d2)
>
> print t1, t2

greg
Guest
Posts: n/a

 11-18-2009
Lee Merrill wrote:
> And I can't do arithmetic, it is actually about 3600--never mind!

Don't feel too bad. Obviously Guido nipped back to
March 8 2008 in his time machine and fixed the problem,
making it *look* like you can't do arithmetic. Time
travel often leads to embarrassments like that.

--
Greg

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post flamesrock Python 8 11-24-2006 06:51 AM Peter Hansen Python 0 02-22-2006 12:03 AM peterbe@gmail.com Python 8 08-05-2005 01:51 PM VB Programmer ASP .Net 0 11-04-2004 02:50 AM engsol Python 2 01-26-2004 12:06 PM