Index: src/base/platform/platform-openbsd.cc |
diff --git a/src/base/platform/platform-openbsd.cc b/src/base/platform/platform-openbsd.cc |
index af145e2fca117696950108c4e04f2c530e0ccf8a..6ecf1f12ba7286b2d1bd3a3ab7644c3c73a043f8 100644 |
--- a/src/base/platform/platform-openbsd.cc |
+++ b/src/base/platform/platform-openbsd.cc |
@@ -37,7 +37,8 @@ namespace base { |
const char* OS::LocalTimezone(double time, TimezoneCache* cache) { |
if (std::isnan(time)) return ""; |
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); |
- struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn) |
+ struct tm tm; |
+ struct tm* t = localtime_r(&tv, &tm); |
if (NULL == t) return ""; |
return t->tm_zone; |
} |
@@ -45,7 +46,8 @@ const char* OS::LocalTimezone(double time, TimezoneCache* cache) { |
double OS::LocalTimeOffset(TimezoneCache* cache) { |
time_t tv = time(NULL); |
- struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn) |
+ struct tm tm; |
+ struct tm* t = localtime_r(&tv, &tm); |
// tm_gmtoff includes any daylight savings offset, so subtract it. |
return static_cast<double>(t->tm_gmtoff * msPerSecond - |
(t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); |