From 9da191ae91c57c6b93ceb67797d5246d50980fa2 Mon Sep 17 00:00:00 2001 From: Andrei Date: Tue, 25 Apr 2017 07:27:03 -0700 Subject: [PATCH] Proper time conversion --- disco/util/snowflake.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/disco/util/snowflake.py b/disco/util/snowflake.py index a1e041d..a9aeb15 100644 --- a/disco/util/snowflake.py +++ b/disco/util/snowflake.py @@ -2,6 +2,7 @@ import six from datetime import datetime +UNIX_EPOCH = datetime(1970, 1, 1) DISCORD_EPOCH = 1420070400000 @@ -21,7 +22,7 @@ def to_unix_ms(snowflake): def from_datetime(date): - return from_timestamp(int(date.strftime('%s'))) + return from_timestamp((date - UNIX_EPOCH).total_seconds()) def from_timestamp(ts):