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

Authored by: Lesmiscore, Grub4K

Fixes https://github.com/yt-dlp/yt-dlp/pull/6056
pull/6139/head
Lesmiscore 2023-01-31 22:30:00 +09:00 zatwierdzone przez GitHub
rodzic 8aa0bd5d10
commit 83c4970e52
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

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