summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2018-02-04 16:58:04 +0100
committerlouiz’ <louiz@louiz.org>2018-02-04 16:58:04 +0100
commit1ebd8a2321c454129d921dc71777f47b97b8db97 (patch)
treef40112a03bac4c7ee5ffa94e89bcdde9077f9752 /src/utils
parentd7cf736adb4837c55d8112160cd4718e549ebaaa (diff)
downloadbiboumi-1ebd8a2321c454129d921dc71777f47b97b8db97.tar.gz
biboumi-1ebd8a2321c454129d921dc71777f47b97b8db97.tar.bz2
biboumi-1ebd8a2321c454129d921dc71777f47b97b8db97.tar.xz
biboumi-1ebd8a2321c454129d921dc71777f47b97b8db97.zip
Fix conversion warnings on 32 bits
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/time.cpp3
-rw-r--r--src/utils/time.hpp5
2 files changed, 5 insertions, 3 deletions
diff --git a/src/utils/time.cpp b/src/utils/time.cpp
index bc2c18d..71306fd 100644
--- a/src/utils/time.cpp
+++ b/src/utils/time.cpp
@@ -9,9 +9,10 @@
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;
+ const std::time_t timestamp = static_cast<std::time_t>(time);
char date_buf[stamp_size];
if (std::strftime(date_buf, stamp_size, "%FT%TZ", std::gmtime(&timestamp)) != stamp_size - 1)
return "";
diff --git a/src/utils/time.hpp b/src/utils/time.hpp
index c71cd9c..4b19634 100644
--- a/src/utils/time.hpp
+++ b/src/utils/time.hpp
@@ -2,9 +2,10 @@
#include <ctime>
#include <string>
+#include <chrono>
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);
-} \ No newline at end of file
+}