From 8cecd3a6b371825bd8b61a4ef24e61be9febceae Mon Sep 17 00:00:00 2001 From: Lance Sun Date: Thu, 7 Nov 2019 21:22:19 -0800 Subject: [PATCH] struct tm doesn't have tm_gmtoff in ISO C The field is a BSD and GNU extension (https://www.gnu.org/software/libc/manual/html_node/Broken_002ddown-Time.html) --- include/spdlog/details/os-inl.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/spdlog/details/os-inl.h b/include/spdlog/details/os-inl.h index 3ec87da9..6e253742 100644 --- a/include/spdlog/details/os-inl.h +++ b/include/spdlog/details/os-inl.h @@ -307,8 +307,10 @@ SPDLOG_INLINE int utc_minutes_offset(const std::tm &tm) }; auto offset_seconds = helper::calculate_gmt_offset(tm); -#else +#elif defined(_BSD_SOURCE) || defined(_GNU_SOURCE) auto offset_seconds = tm.tm_gmtoff; +#else + auto offset_seconds = 0; #endif return static_cast(offset_seconds / 60);