diff options
author | louiz’ <louiz@louiz.org> | 2016-10-03 23:30:20 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2016-10-03 17:58:16 +0200 |
commit | e5b392ece8c90605b86d0d93f0ca6989048bc1c3 (patch) | |
tree | d3fc1e3509680b60cba3526492adcaaf56417f02 /louloulibs | |
parent | fca25b7704014f7a7dec6185afe8e27b591776e4 (diff) | |
download | biboumi-e5b392ece8c90605b86d0d93f0ca6989048bc1c3.tar.gz biboumi-e5b392ece8c90605b86d0d93f0ca6989048bc1c3.tar.bz2 biboumi-e5b392ece8c90605b86d0d93f0ca6989048bc1c3.tar.xz biboumi-e5b392ece8c90605b86d0d93f0ca6989048bc1c3.zip |
Fix parse_datetime by always using a 'z' as the timezone
Because some plateform accept Z and z, but some only accept z…
Diffstat (limited to 'louloulibs')
-rw-r--r-- | louloulibs/utils/time.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/louloulibs/utils/time.cpp b/louloulibs/utils/time.cpp index bc8b3f8..abf0a84 100644 --- a/louloulibs/utils/time.cpp +++ b/louloulibs/utils/time.cpp @@ -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; |