diff python/epoch2date.py @ 719:7c4ee496794c

dst
author Jeff Hammel <k0scist@gmail.com>
date Mon, 03 Nov 2014 10:36:06 -0800
parents 1e1bed921c08
children
line wrap: on
line diff
--- a/python/epoch2date.py	Thu Oct 30 15:22:29 2014 -0700
+++ b/python/epoch2date.py	Mon Nov 03 10:36:06 2014 -0800
@@ -52,7 +52,11 @@
         # output
         if not options.display_utc:
             print ("{} seconds since epoch".format(s))
-            print ("{} {}".format(dt, time.tzname[time.daylight]))
+            if time.daylight and time.localtime(s).tm_isdst:
+                tz_index = 1
+            else:
+                tz_index = 0
+            print ("{} {}".format(dt, time.tzname[tz_index]))
         print ("{} UTC".format(dt2))
 
 if __name__ == '__main__':