Time travel

Discussion in 'Python' started by Lee Merrill, Nov 17, 2009.

  1. Lee Merrill

    Lee Merrill Guest

    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, Nov 17, 2009
    #1
    1. Advertising

  2. Lee Merrill

    Lee Merrill Guest

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


    On Nov 17, 10:37 am, Lee Merrill <> 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
    Lee Merrill, Nov 17, 2009
    #2
    1. Advertising

  3. Lee Merrill

    greg Guest

    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
    greg, Nov 18, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VB Programmer

    Travel site - travel data availability?

    VB Programmer, Nov 4, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    535
    VB Programmer
    Nov 4, 2004
  2. Eþref DURNA

    travel agency project

    Eþref DURNA, May 23, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    7,883
    Eþref DURNA
    May 23, 2005
  3. Bharat Bhushan

    Link List Travel

    Bharat Bhushan, Aug 7, 2003, in forum: Java
    Replies:
    5
    Views:
    500
    Gordon Beaton
    Aug 8, 2003
  4. Muz

    travel/reservation code

    Muz, Jun 19, 2004, in forum: Java
    Replies:
    0
    Views:
    562
  5. Guest
    Replies:
    4
    Views:
    1,174
    Hywel
    Apr 25, 2004
Loading...

Share This Page