Fix parse_datetime by always using a 'z' as the timezone

Because some plateform accept Z and z, but some only accept z…
This commit is contained in:
louiz’
2016-10-03 17:58:16 +02:00
parent fca25b7704
commit e5b392ece8
2 changed files with 4 additions and 6 deletions
+2 -1
View File
@@ -14,8 +14,9 @@ std::string to_string(const std::time_t& timestamp)
std::time_t parse_datetime(const std::string& stamp)
{
auto stamp2 = stamp.substr(0, stamp.size() - 1) + "z";
struct tm tm;
if (!::strptime(stamp.data(), "%FT%T%Z", &tm))
if (!::strptime(stamp2.data(), "%FT%T%Z", &tm))
return -1;
auto res = ::timegm(&tm);
return res;