aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiroslav Šedivý <[email protected]>2022-11-30 20:44:13 +0100
committerMiroslav Šedivý <[email protected]>2022-11-30 20:44:13 +0100
commitbf428f58efbf7989d7771e9edb54fade1009a4e7 (patch)
tree682985123fb981a54225a8f8a8faf3fdfc455f3f /mastodon
parent5262d58a0b97a04bbc3bd07a1c46c4a6a564a61c (diff)
downloadmastodon.py-bf428f58efbf7989d7771e9edb54fade1009a4e7.tar.gz
refactor: simplify __datetime_to_epoch
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index e0b9257..9e30429 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -3925,15 +3925,9 @@ class Mastodon:
3925 3925
3926 Assumes UTC if timezone is not given. 3926 Assumes UTC if timezone is not given.
3927 """ 3927 """
3928 date_time_utc = None
3929 if date_time.tzinfo is None: 3928 if date_time.tzinfo is None:
3930 date_time_utc = date_time.replace(tzinfo=datetime.timezone.utc) 3929 date_time = date_time.replace(tzinfo=datetime.timezone.utc)
3931 else: 3930 return date_time.timestamp()
3932 date_time_utc = date_time.astimezone(datetime.timezone.utc)
3933
3934 epoch_utc = datetime.datetime.utcfromtimestamp(0).replace(tzinfo=datetime.timezone.utc)
3935
3936 return (date_time_utc - epoch_utc).total_seconds()
3937 3931
3938 def __get_logged_in_id(self): 3932 def __get_logged_in_id(self):
3939 """ 3933 """
Powered by cgit v1.2.3 (git 2.41.0)