diff options
author | Lesmiscore <nao20010128@gmail.com> | 2023-01-31 22:30:00 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-31 22:30:00 +0900 |
commit | 83c4970e52839ce8761ec61bd19d549aed7d7920 (patch) | |
tree | 8a2aa38d4650f4af5cf0c1a1fd69ab5fec256763 /yt_dlp/utils.py | |
parent | 8aa0bd5d10627ece3c1815c01d02fb8bf22847a7 (diff) | |
download | hypervideo-pre-83c4970e52839ce8761ec61bd19d549aed7d7920.tar.lz hypervideo-pre-83c4970e52839ce8761ec61bd19d549aed7d7920.tar.xz hypervideo-pre-83c4970e52839ce8761ec61bd19d549aed7d7920.zip |
[utils] Fix `time_seconds` to use the provided TZ (#6118)
Authored by: Lesmiscore, Grub4K
Fixes https://github.com/yt-dlp/yt-dlp/pull/6056
Diffstat (limited to 'yt_dlp/utils.py')
-rw-r--r-- | yt_dlp/utils.py | 6 |
1 files 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 |