Advertisement
rfmonk

time_timezone.py

Jan 17th, 2014
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3.  
  4. import time
  5. import os
  6.  
  7.  
  8. def show_zone_info():
  9.     print ' TZ    :', os.environ.get('TZ', '(not set)')
  10.     print ' tzname:', time.tzname
  11.     print ' Zone  : %d (%d)' % (time.timezone,
  12.                                 (time.timezone / 3600))
  13.     print ' DST   :', time.daylight
  14.     print ' Time  :', time.ctime()
  15.     print
  16.  
  17. print 'Default :'
  18. show_zone_info()
  19.  
  20. ZONES = ['GMT', 'Europe/Amsterdam', ]
  21.  
  22. for zone in ZONES:
  23.     os.environ['TZ'] = zone
  24.     time.tzset()
  25.     print zone, ':'
  26.     show_zone_info()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement