diff --git a/src/windows/port.cc b/src/windows/port.cc index d994325..aa8dcd8 100755 --- a/src/windows/port.cc +++ b/src/windows/port.cc @@ -55,6 +55,12 @@ int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) { return _vsnprintf(str, size-1, format, ap); } +#ifndef HAVE_LOCALTIME_R +struct tm* localtime_r(const time_t* timep, struct tm* result) { + localtime_s(result, timep); + return result; +} +#endif // not HAVE_LOCALTIME_R #ifndef HAVE_SNPRINTF int snprintf(char *str, size_t size, const char *format, ...) { va_list ap; diff --git a/src/windows/port.h b/src/windows/port.h index c7895dd..56b172b 100755 --- a/src/windows/port.h +++ b/src/windows/port.h @@ -148,11 +148,8 @@ enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock #endif // HAVE_PTHREAD #ifndef HAVE_LOCALTIME_R -inline struct tm* localtime_r(const time_t* timep, struct tm* result) { - localtime_s(result, timep); - return result; -} -#endif +extern struct tm* GOOGLE_GLOG_DLL_DECL localtime_r(const time_t* timep, struct tm* result); +#endif // not HAVE_LOCALTIME_R inline char* strerror_r(int errnum, char* buf, size_t buflen) { strerror_s(buf, buflen, errnum);