refactor: simplify __datetime_to_epoch
This commit is contained in:
parent
5262d58a0b
commit
bf428f58ef
@ -3925,15 +3925,9 @@ class Mastodon:
|
|||||||
|
|
||||||
Assumes UTC if timezone is not given.
|
Assumes UTC if timezone is not given.
|
||||||
"""
|
"""
|
||||||
date_time_utc = None
|
|
||||||
if date_time.tzinfo is None:
|
if date_time.tzinfo is None:
|
||||||
date_time_utc = date_time.replace(tzinfo=datetime.timezone.utc)
|
date_time = date_time.replace(tzinfo=datetime.timezone.utc)
|
||||||
else:
|
return date_time.timestamp()
|
||||||
date_time_utc = date_time.astimezone(datetime.timezone.utc)
|
|
||||||
|
|
||||||
epoch_utc = datetime.datetime.utcfromtimestamp(0).replace(tzinfo=datetime.timezone.utc)
|
|
||||||
|
|
||||||
return (date_time_utc - epoch_utc).total_seconds()
|
|
||||||
|
|
||||||
def __get_logged_in_id(self):
|
def __get_logged_in_id(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user