Commit 1ebd8a23 authored by louiz’'s avatar louiz’

Fix conversion warnings on 32 bits

parent d7cf736a
...@@ -9,9 +9,10 @@ ...@@ -9,9 +9,10 @@
namespace utils namespace utils
{ {
std::string to_string(const std::time_t& timestamp) std::string to_string(const std::chrono::system_clock::time_point::rep& time)
{ {
constexpr std::size_t stamp_size = 21; constexpr std::size_t stamp_size = 21;
const std::time_t timestamp = static_cast<std::time_t>(time);
char date_buf[stamp_size]; char date_buf[stamp_size];
if (std::strftime(date_buf, stamp_size, "%FT%TZ", std::gmtime(&timestamp)) != stamp_size - 1) if (std::strftime(date_buf, stamp_size, "%FT%TZ", std::gmtime(&timestamp)) != stamp_size - 1)
return ""; return "";
......
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
#include <ctime> #include <ctime>
#include <string> #include <string>
#include <chrono>
namespace utils namespace utils
{ {
std::string to_string(const std::time_t& timestamp); std::string to_string(const std::chrono::system_clock::time_point::rep& timestamp);
std::time_t parse_datetime(const std::string& stamp); std::time_t parse_datetime(const std::string& stamp);
} }
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment