diff options
| author | Riccardo Spagni <ric@spagni.net> | 2018-01-18 18:14:12 -0500 |
|---|---|---|
| committer | Riccardo Spagni <ric@spagni.net> | 2018-01-18 18:14:12 -0500 |
| commit | d2ff91cb17d15895271cb7d03128dc023c4daeab (patch) | |
| tree | a688b16e32870eeea9ffcf253133ca951ec6ab13 /contrib | |
| parent | ca5383efa9ddaa85e5e731d00f6ab69646879ab2 (diff) | |
| parent | b7e5a70bb1a81d05cf4838f483c4618806f2b792 (diff) | |
| download | monzero-core-d2ff91cb17d15895271cb7d03128dc023c4daeab.tar.gz monzero-core-d2ff91cb17d15895271cb7d03128dc023c4daeab.tar.xz monzero-core-d2ff91cb17d15895271cb7d03128dc023c4daeab.zip | |
Merge pull request #3107
b7e5a70b epee: detect strptime, use std::get_time as fallback (moneromooo-monero)
Diffstat (limited to 'contrib')
| -rw-r--r-- | contrib/epee/include/storages/portable_storage_val_converters.h | 6 |
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 5d9664a65..36bb28627 100644 --- a/contrib/epee/include/storages/portable_storage_val_converters.h +++ b/contrib/epee/include/storages/portable_storage_val_converters.h @@ -150,8 +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(); |
