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:
DevilXD
2020-08-12 10:46:32 +02:00
committed by GitHub
parent 73a34eacd6
commit 6e63ed4e60
10 changed files with 63 additions and 59 deletions

View File

@@ -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(