From da561ba4d57f58ca44bf93e066e4c80d6b5266d9 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Tue, 9 Nov 2021 00:55:18 -0500 Subject: initial msys compatibility --- discord/snowflake.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'discord/snowflake.cpp') diff --git a/discord/snowflake.cpp b/discord/snowflake.cpp index cea9153..6909a15 100644 --- a/discord/snowflake.cpp +++ b/discord/snowflake.cpp @@ -2,6 +2,7 @@ #include #include #include +#include constexpr static uint64_t DiscordEpochSeconds = 1420070400; @@ -42,14 +43,12 @@ bool Snowflake::IsValid() const { return m_num != Invalid; } -std::string Snowflake::GetLocalTimestamp() const { +Glib::ustring Snowflake::GetLocalTimestamp() const { 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(""); - ss.imbue(locale); - ss << std::put_time(&tm, "%X %x"); - return ss.str(); + std::array tmp; + std::strftime(tmp.data(), sizeof(tmp), "%X %x", &tm); + return tmp.data(); } void from_json(const nlohmann::json &j, Snowflake &s) { -- cgit v1.2.3