logging module for python reports incorrect timezone under cygwin
Question: I am running python script that uses logging module under cygwin on Windows 7.
The `date` command reports correct time:

    
    
    $ date
    Tue, Aug 14, 2012  2:47:49 PM
    

However, the python script is five hours off:

    
    
    2012-08-14 19:39:06,438: Done!
    

I don't do anything fancy when I configure logging for the script:

    
    
    logging.basicConfig(format='%(asctime)-15s: %(message)s', level=logging.DEBUG)
    

Can someone tell me what is going on and how I can fix it?


Answer: You need to unset the environment "TZ" in your python script prior to any
importing the date/time modules. It is set by cygwin but not understood by
Windows:

    
    
    if os.getenv("TZ"):
        os.unsetenv("TZ")
    

