comparison python/epoch2date.py @ 719:7c4ee496794c

dst
author Jeff Hammel <k0scist@gmail.com>
date Mon, 03 Nov 2014 10:36:06 -0800
parents 1e1bed921c08
children
comparison
equal deleted inserted replaced
718:cd9d65e6e2ab 719:7c4ee496794c
50 dt2 = datetime.datetime.utcfromtimestamp(s) 50 dt2 = datetime.datetime.utcfromtimestamp(s)
51 51
52 # output 52 # output
53 if not options.display_utc: 53 if not options.display_utc:
54 print ("{} seconds since epoch".format(s)) 54 print ("{} seconds since epoch".format(s))
55 print ("{} {}".format(dt, time.tzname[time.daylight])) 55 if time.daylight and time.localtime(s).tm_isdst:
56 tz_index = 1
57 else:
58 tz_index = 0
59 print ("{} {}".format(dt, time.tzname[tz_index]))
56 print ("{} UTC".format(dt2)) 60 print ("{} UTC".format(dt2))
57 61
58 if __name__ == '__main__': 62 if __name__ == '__main__':
59 main() 63 main()