i hate pytz, i hate python2, i hate everything

This commit is contained in:
Franzi 2023-12-27 10:42:24 +01:00
parent 025e1bf2c7
commit de1f01b004

View file

@ -125,6 +125,7 @@ def main():
raw_schedule["conference"]["start"][:10], "%Y-%m-%d" raw_schedule["conference"]["start"][:10], "%Y-%m-%d"
) )
event_tz = pytz.timezone(raw_schedule["conference"]["time_zone_name"]) event_tz = pytz.timezone(raw_schedule["conference"]["time_zone_name"])
utc_offset = datetime.now(event_tz).utcoffset().total_seconds()
for day in raw_schedule["conference"]["days"]: for day in raw_schedule["conference"]["days"]:
for room in day["rooms"].values(): for room in day["rooms"].values():
@ -135,9 +136,9 @@ def main():
d_h, d_m = talk["duration"].split(":") d_h, d_m = talk["duration"].split(":")
end = start + timedelta(hours=int(d_h), minutes=int(d_m)) end = start + timedelta(hours=int(d_h), minutes=int(d_m))
talk["start_ts"] = timegm(start.timetuple()) talk["start_ts"] = int(timegm(start.timetuple()) - utc_offset)
talk["start_str"] = talk["start"] talk["start_str"] = talk["start"]
talk["end_ts"] = timegm(end.timetuple()) talk["end_ts"] = int(timegm(end.timetuple()) - utc_offset)
talk["locale"] = talk["language"] talk["locale"] = talk["language"]
track = None track = None