From 83c4970e52839ce8761ec61bd19d549aed7d7920 Mon Sep 17 00:00:00 2001 From: Lesmiscore Date: Tue, 31 Jan 2023 22:30:00 +0900 Subject: [PATCH] [utils] Fix `time_seconds` to use the provided TZ (#6118) Authored by: Lesmiscore, Grub4K Fixes https://github.com/yt-dlp/yt-dlp/pull/6056 --- yt_dlp/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index 458239a12..7d51fe472 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -5585,8 +5585,10 @@ def get_first(obj, keys, **kwargs): def time_seconds(**kwargs): - t = datetime.datetime.now(datetime.timezone(datetime.timedelta(**kwargs))) - return t.timestamp() + """ + Returns TZ-aware time in seconds since the epoch (1970-01-01T00:00:00Z) + """ + return time.time() + datetime.timedelta(**kwargs).total_seconds() # create a JSON Web Signature (jws) with HS256 algorithm