fork download
  1. import calendar
  2. import time
  3. import pytz
  4. import datetime as DT
  5.  
  6. utc = pytz.timezone('UTC')
  7.  
  8. for tzname in [name for name in pytz.all_timezones if 'Brazil' in name]:
  9. tz1 = pytz.timezone(tzname)
  10. date = utc.localize(DT.datetime(2013, 1, 1))
  11. print(tzname)
  12. while date.year == 2013:
  13. now_tz = date.astimezone(tz1)
  14. now_epoch = calendar.timegm(now_tz.utctimetuple())
  15. begin_day = now_tz.replace(hour=0, minute=0, second=0)
  16. try:
  17. assert now_tz.utcoffset() == begin_day.utcoffset()
  18. except AssertionError:
  19. print(date)
  20. print(repr(now_tz))
  21. print(repr(begin_day))
  22. print(now_tz.utcoffset(), begin_day.utcoffset())
  23. print('-'*80)
  24. date = date + DT.timedelta(hours=1)
  25.  
Success #stdin #stdout 0.82s 9512KB
stdin
Standard input is empty
stdout
Brazil/Acre
Brazil/DeNoronha
Brazil/East
Brazil/West