diff options
| author | Wladimir J. van der Laan <[email protected]> | 2018-04-26 17:22:16 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2018-04-26 17:22:47 +0200 |
| commit | 826acc9a3d023ca1fa49fcb9daa82dea454032d5 (patch) | |
| tree | 95aec398116b601438633ebff96d742f37d6e60a /src | |
| parent | Merge #12321: p2wsh and p2sh-p2wsh address in decodescript (diff) | |
| parent | Fix for utiltime to compile with msvc. (diff) | |
| download | discoin-826acc9a3d023ca1fa49fcb9daa82dea454032d5.tar.xz discoin-826acc9a3d023ca1fa49fcb9daa82dea454032d5.zip | |
Merge #13031: Fix for utiltime to compile with msvc.
abd58a2 Fix for utiltime to compile with msvc. (Aaron Clauson)
Pull request description:
This PR allows utiltime.cpp to compile with msvc after the changes introduced in #12973.
Tree-SHA512: 7233b1c23400bf19aef2fcb6168009ef58b9e7f8e49c46d8cf9d04394091f370e39496d24ca00b294c4164bcfc04514e329bf6bb05169406c34ce7cd8c382565
Diffstat (limited to 'src')
| -rw-r--r-- | src/utiltime.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/utiltime.cpp b/src/utiltime.cpp index 34800c7b6..e60996efe 100644 --- a/src/utiltime.cpp +++ b/src/utiltime.cpp @@ -79,20 +79,32 @@ void MilliSleep(int64_t n) std::string FormatISO8601DateTime(int64_t nTime) { struct tm ts; time_t time_val = nTime; +#ifdef _MSC_VER + gmtime_s(&ts, &time_val); +#else gmtime_r(&time_val, &ts); +#endif return strprintf("%04i-%02i-%02iT%02i:%02i:%02iZ", ts.tm_year + 1900, ts.tm_mon + 1, ts.tm_mday, ts.tm_hour, ts.tm_min, ts.tm_sec); } std::string FormatISO8601Date(int64_t nTime) { struct tm ts; time_t time_val = nTime; +#ifdef _MSC_VER + gmtime_s(&ts, &time_val); +#else gmtime_r(&time_val, &ts); +#endif return strprintf("%04i-%02i-%02i", ts.tm_year + 1900, ts.tm_mon + 1, ts.tm_mday); } std::string FormatISO8601Time(int64_t nTime) { struct tm ts; time_t time_val = nTime; +#ifdef _MSC_VER + gmtime_s(&ts, &time_val); +#else gmtime_r(&time_val, &ts); +#endif return strprintf("%02i:%02i:%02iZ", ts.tm_hour, ts.tm_min, ts.tm_sec); } |