diff options
author | luigi1111 <luigi1111w@gmail.com> | 2016-06-20 18:14:12 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2016-06-20 18:14:12 -0500 |
commit | 57dce8083a191c28f59710ad9c969c03605e9cb7 (patch) | |
tree | a2bc078ed0168f45f24c0d2564a4b46375f69471 /src/simplewallet/simplewallet.cpp | |
parent | Merge pull request #865 (diff) | |
download | monero-57dce8083a191c28f59710ad9c969c03605e9cb7.tar.xz |
gmtime for Windows
gmtime_r is not available in Windows, use gmtime_s instead. Also change shorthand codes (also not working in Windows).
Diffstat (limited to 'src/simplewallet/simplewallet.cpp')
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 7d28de9c0..9f72b889f 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -2968,13 +2968,17 @@ static std::string get_human_readable_timestamp(uint64_t ts) return "<unknown>"; time_t tt = ts; struct tm tm; +#ifdef WIN32 + gmtime_s(&tm, &tt); +#else gmtime_r(&tt, &tm); +#endif uint64_t now = time(NULL); uint64_t diff = ts > now ? ts - now : now - ts; if (diff > 24*3600) - strftime(buffer, sizeof(buffer), "%F", &tm); + strftime(buffer, sizeof(buffer), "%Y-%m-%d", &tm); else - strftime(buffer, sizeof(buffer), "%r", &tm); + strftime(buffer, sizeof(buffer), "%I:%M:%S %p", &tm); return std::string(buffer); } //---------------------------------------------------------------------------------------------------- |