Refactor utcfromtimestamp to use fromtimestamp(..., tz=utc)

This commit is contained in:
Rapptz
2021-07-09 04:20:45 -04:00
parent 826ce101fd
commit 8fb998b599
3 changed files with 10 additions and 11 deletions

View File

@@ -323,7 +323,7 @@ def snowflake_time(id: int) -> datetime.datetime:
An aware datetime in UTC representing the creation time of the snowflake.
"""
timestamp = ((id >> 22) + DISCORD_EPOCH) / 1000
return datetime.datetime.utcfromtimestamp(timestamp).replace(tzinfo=datetime.timezone.utc)
return datetime.datetime.fromtimestamp(timestamp, tz=datetime.timezone.utc)
def time_snowflake(dt: datetime.datetime, high: bool = False) -> int: