port: split localtime_r definition and impl
This commit is contained in:
parent
7450a8b345
commit
800bd423e4
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user