diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-04-12 02:21:26 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-04-12 02:21:26 -0400 |
commit | bf9b053d365344476b13e837f0b9da28cf8220f9 (patch) | |
tree | 6fa155c78f425fb37fc0cb26fe3a3a07abe34bd5 /discord | |
parent | 244726fc66c98215b2ec7d0ee43e668f431d5861 (diff) | |
download | abaddon-portaudio-bf9b053d365344476b13e837f0b9da28cf8220f9.tar.gz abaddon-portaudio-bf9b053d365344476b13e837f0b9da28cf8220f9.zip |
split messages from the same author after 10 mins
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); |