mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-23 13:36:35 +00:00
Always use the UTC time zone
This commit is contained in:
parent
4934070183
commit
b6466c9b0e
@ -1,8 +1,8 @@
|
||||
import datetime
|
||||
|
||||
|
||||
posix_epoch = datetime.datetime.utcfromtimestamp(0)
|
||||
utc_tz = datetime.timezone.utc
|
||||
posix_epoch = datetime.datetime.fromtimestamp(0, utc_tz)
|
||||
|
||||
|
||||
def add_epoch(seconds):
|
||||
@ -13,10 +13,9 @@ def add_epoch(seconds):
|
||||
|
||||
def subtract_epoch(arg_dt, /):
|
||||
assert isinstance(arg_dt, datetime.datetime)
|
||||
epoch = posix_epoch.astimezone(utc_tz)
|
||||
utc_dt = arg_dt.astimezone(utc_tz)
|
||||
|
||||
return utc_dt - epoch
|
||||
return utc_dt - posix_epoch
|
||||
|
||||
def datetime_to_timestamp(arg_dt, /, *, integer=True):
|
||||
timestamp = subtract_epoch(arg_dt).total_seconds()
|
||||
|
Loading…
Reference in New Issue
Block a user