~singpolyma/biboumi

1ebd8a2321c454129d921dc71777f47b97b8db97 — louiz’ 6 years ago d7cf736
Fix conversion warnings on 32 bits
2 files changed, 5 insertions(+), 3 deletions(-)

M src/utils/time.cpp
M src/utils/time.hpp
M src/utils/time.cpp => src/utils/time.cpp +2 -1
@@ 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 "";

M src/utils/time.hpp => src/utils/time.hpp +3 -2
@@ 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
}