I want to compare UTC timestamps from a log file with local timestamps. When creating the local datetime object, I use something like:
datetime
>>&
now_dt = datetime.datetime.now() utc_now = datetime.datetime.utcnow() now_ts, utc_ts = map(time.mktime, map(datetime.datetime.timetuple, (now_dt, utc_now))) offset = int((now_ts - utc_ts) / 3600)
hope this will help you.