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

Authored by: Lesmiscore, Grub4K

Fixes https://github.com/yt-dlp/yt-dlp/pull/6056
This commit is contained in:
Lesmiscore 2023-01-31 22:30:00 +09:00 committed by GitHub
parent 8aa0bd5d10
commit 83c4970e52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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