Uploaded image for project: 'Pegasus'
  1. Pegasus
  2. PM-576

python ISO8601 time stamp time zones problem

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Monitord
    • Labels:
      None

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: