diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-06-21 09:32:32 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-06-21 09:32:32 +0200 |
commit | de91bb75a1669dc1d5baf5a48379cf1d63707c76 (patch) | |
tree | b55f15ff0571dd094b9e0ce685a62eec8bf70884 /src | |
parent | Merge pull request #869 (diff) | |
parent | gmtime for Windows (diff) | |
download | monero-de91bb75a1669dc1d5baf5a48379cf1d63707c76.tar.xz |
Merge pull request #870
57dce80 gmtime for Windows (luigi1111)
Diffstat (limited to 'src')
-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 51f4109a8..22ddb0639 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -2969,13 +2969,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); } //---------------------------------------------------------------------------------------------------- |