Skip to content

A feature-rich command-line audio/video downloader

[utils] Fix `time_seconds` to use the provided TZ (#6118)

Lesmiscore83c4970e5283
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index 458239a125..7d51fe472e 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