summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-03-13 21:20:32 +0100
committermathieui <mathieui@mathieui.net>2021-03-13 22:15:42 +0100
commit4c7b23ab6802d83be4e72e209fcaff0b4faaa572 (patch)
tree75dc89a9ccfcd23c1bd5b6d403ec921e343acd02
parent9d3af61bbf0d4774e042e56d9eff27d7a8ed0b98 (diff)
downloadpoezio-4c7b23ab6802d83be4e72e209fcaff0b4faaa572.tar.gz
poezio-4c7b23ab6802d83be4e72e209fcaff0b4faaa572.tar.bz2
poezio-4c7b23ab6802d83be4e72e209fcaff0b4faaa572.tar.xz
poezio-4c7b23ab6802d83be4e72e209fcaff0b4faaa572.zip
style: do not override the loaded time module
-rw-r--r--poezio/common.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/poezio/common.py b/poezio/common.py
index 9f218160..69e41c83 100644
--- a/poezio/common.py
+++ b/poezio/common.py
@@ -496,15 +496,15 @@ def unique_prefix_of(a: str, b: str) -> str:
return a
-def to_utc(time: datetime) -> datetime:
+def to_utc(time_: datetime) -> datetime:
"""Convert a datetime-aware time zone into raw UTC"""
tzone = datetime.now().astimezone().tzinfo
- if time.tzinfo is not None: # Convert to UTC
- time = time.astimezone(tz=timezone.utc)
+ if time_.tzinfo is not None: # Convert to UTC
+ time_ = time_.astimezone(tz=timezone.utc)
else: # Assume local tz, convert to URC
- time = time.replace(tzinfo=tzone).astimezone(tz=timezone.utc)
+ time = time_.replace(tzinfo=tzone).astimezone(tz=timezone.utc)
# Return an offset-naive datetime
- return time.replace(tzinfo=None)
+ return time_.replace(tzinfo=None)
# http://xmpp.org/extensions/xep-0045.html#errorstatus