python ISO8601 time stamp time zones problem

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major
    • None
    • Affects Version/s: None
    • Component/s: Monitord
    • None

      I noticed that our python library is generating the wrong time zone offset for ISO 8601 time stamps. Here is what I found:

      $ python
      Python 2.6.6 (r266:84292, Dec 7 2011, 20:48:22)
      >>> import time
      >>> print time.strftime("%z")
      -0800
      >>> print time.timezone
      28800

      so far, so good. However:

      >>> print time.strftime("%z", time.localtime( int(time.time()) ))
      +0000
      >>> print time.strftime("%z",time.localtime())
      +0000

      This is wrong.

      I believe that the time.localtime() function is not working properly. In C this would assemble the struct tm record, and strftime in C has no problems with the zone info. I am sure that python recommends to use some other way to get the proper time stamp assembled so that strftime() will be able to put a proper zone into it.

            Assignee:
            Gaurang Mehta (Inactive)
            Reporter:
            Jens Voeckler
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: