mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 02:16:09 -05:00
Use aware objects when storing and reading UTC timestamps (#4017)
* Use aware objects instead of naive ones * Use aware objects when storing and reading UTC timestamps * Remove unneeded parentheses * Fixed naive and aware objects unable to be compared here * Address feedback * Fix the newly added `modlog.create_case()` calls Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
@@ -3,10 +3,9 @@ import contextlib
|
||||
import platform
|
||||
import sys
|
||||
import codecs
|
||||
import datetime
|
||||
import logging
|
||||
import traceback
|
||||
from datetime import timedelta
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import aiohttp
|
||||
import discord
|
||||
@@ -55,7 +54,7 @@ def init_events(bot, cli_flags):
|
||||
if bot._uptime is not None:
|
||||
return
|
||||
|
||||
bot._uptime = datetime.datetime.utcnow()
|
||||
bot._uptime = datetime.utcnow()
|
||||
|
||||
guilds = len(bot.guilds)
|
||||
users = len(set([m for m in bot.get_all_members()]))
|
||||
@@ -313,7 +312,7 @@ def init_events(bot, cli_flags):
|
||||
not bot._checked_time_accuracy
|
||||
or (discord_now - timedelta(minutes=60)) > bot._checked_time_accuracy
|
||||
):
|
||||
system_now = datetime.datetime.utcnow()
|
||||
system_now = datetime.utcnow()
|
||||
diff = abs((discord_now - system_now).total_seconds())
|
||||
if diff > 60:
|
||||
log.warning(
|
||||
|
||||
Reference in New Issue
Block a user