Created
August 18, 2014 20:20
-
-
Save unutbu/007796e17134b6736571 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import calendar | |
import time | |
import pytz | |
import datetime as DT | |
utc = pytz.timezone('UTC') | |
for tzname in [name for name in pytz.all_timezones if 'Brazil' in name]: | |
tz1 = pytz.timezone(tzname) | |
date = utc.localize(DT.datetime(2013, 1, 1)) | |
print(tzname) | |
while date.year == 2013: | |
now_tz = date.astimezone(tz1) | |
now_epoch = calendar.timegm(now_tz.utctimetuple()) | |
begin_day = now_tz.replace(hour=0, minute=0, second=0) | |
try: | |
assert now_tz.utcoffset() == begin_day.utcoffset() | |
except AssertionError: | |
print(date) | |
print(repr(now_tz)) | |
print(repr(begin_day)) | |
print(now_tz.utcoffset(), begin_day.utcoffset()) | |
print('-'*80) | |
date = date + DT.timedelta(hours=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment