aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/include/storages
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/epee/include/storages')
-rw-r--r--contrib/epee/include/storages/portable_storage_val_converters.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/contrib/epee/include/storages/portable_storage_val_converters.h b/contrib/epee/include/storages/portable_storage_val_converters.h
index 52aa09eba..36bb28627 100644
--- a/contrib/epee/include/storages/portable_storage_val_converters.h
+++ b/contrib/epee/include/storages/portable_storage_val_converters.h
@@ -28,6 +28,7 @@
#pragma once
+#include <time.h>
#include <boost/regex.hpp>
#include "misc_language.h"
@@ -149,9 +150,14 @@ POP_WARNINGS
else if (boost::regex_match (from, boost::regex("\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\dZ")))
{
// Convert to unix timestamp
+#ifdef HAVE_STRPTIME
+ struct tm tm;
+ if (strptime(from.c_str(), "%Y-%m-%dT%H:%M:%S", &tm))
+#else
std::tm tm = {};
std::istringstream ss(from);
if (ss >> std::get_time(&tm, "%Y-%m-%dT%H:%M:%S"))
+#endif
to = std::mktime(&tm);
} else
ASSERT_AND_THROW_WRONG_CONVERSION();