epee: use strptime instead of std::get_time, for compatibility

This commit is contained in:
moneromooo-monero 2017-12-21 16:04:47 +00:00
parent 7a9a4a6669
commit 373d1d504b
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 3 additions and 3 deletions

View File

@ -28,6 +28,7 @@
#pragma once
#include <time.h>
#include <boost/regex.hpp>
#include "misc_language.h"
@ -149,9 +150,8 @@ 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
std::tm tm = {};
std::istringstream ss(from);
if (ss >> std::get_time(&tm, "%Y-%m-%dT%H:%M:%S"))
struct tm tm;
if (strptime(from.c_str(), "%Y-%m-%dT%H:%M:%S", &tm))
to = std::mktime(&tm);
} else
ASSERT_AND_THROW_WRONG_CONVERSION();