Commit 800bd423 authored by NeroBurner's avatar NeroBurner Committed by NeroBurner

port: split localtime_r definition and impl

parent 7450a8b3
...@@ -55,6 +55,12 @@ int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) { ...@@ -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); 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 #ifndef HAVE_SNPRINTF
int snprintf(char *str, size_t size, const char *format, ...) { int snprintf(char *str, size_t size, const char *format, ...) {
va_list ap; va_list ap;
......
...@@ -148,11 +148,8 @@ enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock ...@@ -148,11 +148,8 @@ enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock
#endif // HAVE_PTHREAD #endif // HAVE_PTHREAD
#ifndef HAVE_LOCALTIME_R #ifndef HAVE_LOCALTIME_R
inline struct tm* localtime_r(const time_t* timep, struct tm* result) { extern struct tm* GOOGLE_GLOG_DLL_DECL localtime_r(const time_t* timep, struct tm* result);
localtime_s(result, timep); #endif // not HAVE_LOCALTIME_R
return result;
}
#endif
inline char* strerror_r(int errnum, char* buf, size_t buflen) { inline char* strerror_r(int errnum, char* buf, size_t buflen) {
strerror_s(buf, buflen, errnum); strerror_s(buf, buflen, errnum);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment