From fc6da99f93f694595bfd8db151206abab42a7f2c Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Sun, 3 Dec 2023 16:02:05 +0100 Subject: [PATCH] Minor fixes to the time stamps --- include/rfl/Timestamp.hpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/rfl/Timestamp.hpp b/include/rfl/Timestamp.hpp index e3a550f7..e094fecc 100644 --- a/include/rfl/Timestamp.hpp +++ b/include/rfl/Timestamp.hpp @@ -2,7 +2,11 @@ #define RFL_TIMESTAMP_HPP_ #include +#include +#include #include +#include +#include #include #include @@ -22,7 +26,7 @@ class Timestamp { using ReflectionType = std::string; Timestamp(const char* _str) { - const auto r = strptime(_str, format_.value_, &tm_); + const auto r = strptime(_str, _format.value_, &tm_); if (r == NULL) { throw std::runtime_error("String '" + std::string(_str) + "' did not match format '" + Format().str() + @@ -71,14 +75,14 @@ class Timestamp { private: #ifdef _MSC_VER // This workaround is necessary, because MSVC doesn't support strptime. - char* strptime(const char* _s, const char* _f, struct tm* _tm) { + char* strptime(const char* _s, const char* _f, std::tm* _tm) { std::istringstream input(_s); input.imbue(std::locale(setlocale(LC_ALL, nullptr))); input >> std::get_time(_tm, _f); if (input.fail()) { return NULL; } - return (char*)(s + input.tellg()); + return (char*)(_s + input.tellg()); } #endif