@@ -99,10 +99,10 @@ std::string DurationToDHMS(int64_t nDurationTime)
99
99
std::string FormatISO8601DateTime (int64_t nTime) {
100
100
struct tm ts;
101
101
time_t time_val = nTime;
102
- #ifdef _MSC_VER
103
- if (gmtime_s (&ts, &time_val) != 0 ) {
104
- #else
102
+ #ifdef HAVE_GMTIME_R
105
103
if (gmtime_r (&time_val, &ts) == nullptr ) {
104
+ #else
105
+ if (gmtime_s (&ts, &time_val) != 0 ) {
106
106
#endif
107
107
return {};
108
108
}
@@ -112,10 +112,10 @@ std::string FormatISO8601DateTime(int64_t nTime) {
112
112
std::string FormatISO8601DateTimeForBackup (int64_t nTime) {
113
113
struct tm ts;
114
114
time_t time_val = nTime;
115
- #ifdef _MSC_VER
116
- if (gmtime_s (&ts, &time_val) != 0 ) {
117
- #else
115
+ #ifdef HAVE_GMTIME_R
118
116
if (gmtime_r (&time_val, &ts) == nullptr ) {
117
+ #else
118
+ if (gmtime_s (&ts, &time_val) != 0 ) {
119
119
#endif
120
120
return {};
121
121
}
@@ -125,10 +125,10 @@ std::string FormatISO8601DateTimeForBackup(int64_t nTime) {
125
125
std::string FormatISO8601Date (int64_t nTime) {
126
126
struct tm ts;
127
127
time_t time_val = nTime;
128
- #ifdef _MSC_VER
129
- if (gmtime_s (&ts, &time_val) != 0 ) {
130
- #else
128
+ #ifdef HAVE_GMTIME_R
131
129
if (gmtime_r (&time_val, &ts) == nullptr ) {
130
+ #else
131
+ if (gmtime_s (&ts, &time_val) != 0 ) {
132
132
#endif
133
133
return {};
134
134
}
@@ -138,10 +138,10 @@ std::string FormatISO8601Date(int64_t nTime) {
138
138
std::string FormatISO8601Time (int64_t nTime) {
139
139
struct tm ts;
140
140
time_t time_val = nTime;
141
- #ifdef _MSC_VER
142
- if (gmtime_s (&ts, &time_val) != 0 ) {
143
- #else
141
+ #ifdef HAVE_GMTIME_R
144
142
if (gmtime_r (&time_val, &ts) == nullptr ) {
143
+ #else
144
+ if (gmtime_s (&ts, &time_val) != 0 ) {
145
145
#endif
146
146
return {};
147
147
}
0 commit comments