diff options
Diffstat (limited to 'discord')
-rw-r--r-- | discord/snowflake.cpp | 2 | ||||
-rw-r--r-- | discord/snowflake.hpp | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/discord/snowflake.cpp b/discord/snowflake.cpp index 595f87c..18c7805 100644 --- a/discord/snowflake.cpp +++ b/discord/snowflake.cpp @@ -41,7 +41,7 @@ bool Snowflake::IsValid() const { } std::string Snowflake::GetLocalTimestamp() const { - const time_t secs_since_epoch = (m_num / 4194304000) + 1420070400; + const time_t secs_since_epoch = (m_num / SecondsInterval) + DiscordEpochSeconds; const std::tm tm = *localtime(&secs_since_epoch); std::stringstream ss; const static std::locale locale(""); diff --git a/discord/snowflake.hpp b/discord/snowflake.hpp index c6770a1..4263bab 100644 --- a/discord/snowflake.hpp +++ b/discord/snowflake.hpp @@ -26,7 +26,8 @@ struct Snowflake { return m_num; } - const static int Invalid = -1; + const static uint64_t Invalid = -1ULL; // makes sense to me + const static uint64_t SecondsInterval = 4194304000ULL; // the "difference" between two snowflakes one second apart friend void from_json(const nlohmann::json &j, Snowflake &s); friend void to_json(nlohmann::json &j, const Snowflake &s); |