Update os-inl.h

This commit is contained in:
Gabi Melman 2019-10-20 18:31:04 +03:00 committed by GitHub
parent d9f726f2a5
commit 8a638a95a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,10 +113,10 @@ SPDLOG_INLINE std::tm gmtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT
#ifdef _WIN32 #ifdef _WIN32
std::tm tm; std::tm tm;
gmtime_s(&tm, &time_tt); ::gmtime_s(&tm, &time_tt);
#else #else
std::tm tm; std::tm tm;
gmtime_r(&time_tt, &tm); ::gmtime_r(&time_tt, &tm);
#endif #endif
return tm; return tm;
} }
@ -261,7 +261,7 @@ SPDLOG_INLINE int utc_minutes_offset(const std::tm &tm)
auto rv = ::GetTimeZoneInformation(&tzinfo); auto rv = ::GetTimeZoneInformation(&tzinfo);
#else #else
DYNAMIC_TIME_ZONE_INFORMATION tzinfo; DYNAMIC_TIME_ZONE_INFORMATION tzinfo;
auto rv = ::filnoGetDynamicTimeZoneInformation(&tzinfo); auto rv = ::GetDynamicTimeZoneInformation(&tzinfo);
#endif #endif
if (rv == TIME_ZONE_ID_INVALID) if (rv == TIME_ZONE_ID_INVALID)
SPDLOG_THROW(spdlog::spdlog_ex("Failed getting timezone info. ", errno)); SPDLOG_THROW(spdlog::spdlog_ex("Failed getting timezone info. ", errno));
@ -327,15 +327,15 @@ SPDLOG_INLINE size_t _thread_id() SPDLOG_NOEXCEPT
#if defined(__ANDROID__) && defined(__ANDROID_API__) && (__ANDROID_API__ < 21) #if defined(__ANDROID__) && defined(__ANDROID_API__) && (__ANDROID_API__ < 21)
#define SYS_gettid __NR_gettid #define SYS_gettid __NR_gettid
#endif #endif
return static_cast<size_t>(syscall(SYS_gettid)); return static_cast<size_t>(::syscall(SYS_gettid));
#elif defined(_AIX) || defined(__DragonFly__) || defined(__FreeBSD__) #elif defined(_AIX) || defined(__DragonFly__) || defined(__FreeBSD__)
return static_cast<size_t>(pthread_getthreadid_np()); return static_cast<size_t>(::pthread_getthreadid_np());
#elif defined(__NetBSD__) #elif defined(__NetBSD__)
return static_cast<size_t>(_lwp_self()); return static_cast<size_t>(::_lwp_self());
#elif defined(__OpenBSD__) #elif defined(__OpenBSD__)
return static_cast<size_t>(getthrid()); return static_cast<size_t>(::getthrid());
#elif defined(__sun) #elif defined(__sun)
return static_cast<size_t>(thr_self()); return static_cast<size_t>(::thr_self());
#elif __APPLE__ #elif __APPLE__
uint64_t tid; uint64_t tid;
pthread_threadid_np(nullptr, &tid); pthread_threadid_np(nullptr, &tid);
@ -420,9 +420,9 @@ SPDLOG_INLINE bool in_terminal(FILE *file) SPDLOG_NOEXCEPT
{ {
#ifdef _WIN32 #ifdef _WIN32
return _isatty(_fileno(file)) != 0; return ::_isatty(_fileno(file)) != 0;
#else #else
return isatty(fileno(file)) != 0; return ::isatty(fileno(file)) != 0;
#endif #endif
} }