From cdac7641d68060de576406faaa72c647f3cb2a36 Mon Sep 17 00:00:00 2001 From: Elyse <26639800+elyse0@users.noreply.github.com> Date: Sat, 11 Mar 2023 18:20:32 -0600 Subject: [PATCH] Remove tz_aware date code --- yt_dlp/utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index 3edb7b053..bc2c36299 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -1868,9 +1868,8 @@ def unified_timestamp(date_str, day_first=True, with_milliseconds=False): for expression in date_formats(day_first): with contextlib.suppress(ValueError): - dt = datetime.datetime.strptime(date_str, expression) + datetime.timedelta(hours=pm_delta) - dt_tz_aware = dt.replace(tzinfo=datetime.timezone(timezone)) - return dt_tz_aware.timestamp() if with_milliseconds else int(dt_tz_aware.timestamp()) + dt = datetime.datetime.strptime(date_str, expression) - timezone + datetime.timedelta(hours=pm_delta) + return calendar.timegm(dt.timetuple()) + (dt.microsecond / 1e6 if with_milliseconds else 0) timetuple = email.utils.parsedate_tz(date_str) if timetuple: