From bae3d6a75337cf7df58505fd5759ff3bd8df723e Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 25 Mar 2021 22:15:10 +0000 Subject: Create utc datetime objects from timestamps --- bot/exts/help_channels/_channel.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bot/exts/help_channels/_channel.py b/bot/exts/help_channels/_channel.py index 9f6bc00a4..76cce1249 100644 --- a/bot/exts/help_channels/_channel.py +++ b/bot/exts/help_channels/_channel.py @@ -58,8 +58,8 @@ async def get_closing_time(channel: discord.TextChannel, init_done: bool) -> t.T return msg.created_at + timedelta(minutes=idle_minutes), "latest_message" # Get the later time at which a channel should be closed - non_claimant_last_message_time = datetime.fromtimestamp(non_claimant_last_message_time) - claimant_last_message_time = datetime.fromtimestamp(claimant_last_message_time) + non_claimant_last_message_time = datetime.utcfromtimestamp(non_claimant_last_message_time) + claimant_last_message_time = datetime.utcfromtimestamp(claimant_last_message_time) non_claimant_last_message_time += timedelta(minutes=idle_minutes) claimant_last_message_time += timedelta(minutes=constants.HelpChannels.idle_minutes_claimant) @@ -85,8 +85,8 @@ async def get_in_use_time(channel_id: int) -> t.Optional[timedelta]: claimed_timestamp = await _caches.claim_times.get(channel_id) if claimed_timestamp: - claimed = datetime.fromtimestamp(claimed_timestamp) - return datetime.now() - claimed + claimed = datetime.utcfromtimestamp(claimed_timestamp) + return datetime.utcnow() - claimed def is_excluded_channel(channel: discord.abc.GuildChannel) -> bool: -- cgit v1.2.3