You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
spdlog uses the function utc_minutes_offset in the z_formatter to format the '%z'-part of a format string (UTC-offset) when logging time. The function has three implementations, one of which is chosen at compile time via marcro defines (Windows, SunOS/Solaris, default):
// 'tm_gmtoff' field is BSD extension and it's missing on SunOS/Solaris
This test doesn't detect Apple platforms, which have had the tm_gmtoff-field at least since Mac OS X 10.0, and also doesn't detect POSIX.1-2024 conforming systems, which are also required to support tm_gmtoff.
On Apple and POSIX1.-2024 platforms, this has the unfortunate effect to use the SunOS/Solaris fallback, which doesn't compute the correct value if the passed value of tm isn't the current system time, i.e. localtime(::time()) (#3351).
I suggest to fix this by changing the test to something like
#if defined(sun) || defined(__sun) || defined(_AIX) || \
(defined(__NEWLIB__) && !defined(__TM_GMTOFF)) || \
(!defined(__APPLE__) && !defined(_BSD_SOURCE) && !defined(_GNU_SOURCE) && \
(!defined(_POSIX_VERSION) || (_POSIX_VERSION < 202405L)))
// 'tm_gmtoff' field is BSD extension and it's missing on SunOS/Solaris
The text was updated successfully, but these errors were encountered:
toh-ableton
changed the title
Missing test for __APPLE__ chooses buggy SunOS/Solaris workaround in
Missing test for __APPLE__ chooses buggy SunOS/Solaris workaround in utc_minutes_offset
Feb 28, 2025
…workaround)
Apple platforms have had the tm_gmtoff-field at least since Mac OS X 10.0,
as are POSIX.1-2024 conforming systems, which are also required to support
it.
This has the unfortunate effect to use the SunOS/Solaris fallback, which
doesn't compute the correct value if the passed value of tm isn't the
current system time, i.e. localtime(::time()) (gabime#3351).
spdlog uses the function
utc_minutes_offset
in thez_formatter
to format the'%z'
-part of a format string (UTC-offset) when logging time. The function has three implementations, one of which is chosen at compile time via marcro defines (Windows, SunOS/Solaris, default):spdlog/include/spdlog/details/os-inl.h
Lines 268 to 271 in 3335c38
This test doesn't detect Apple platforms, which have had the
tm_gmtoff
-field at least since Mac OS X 10.0, and also doesn't detect POSIX.1-2024 conforming systems, which are also required to supporttm_gmtoff
.On Apple and POSIX1.-2024 platforms, this has the unfortunate effect to use the SunOS/Solaris fallback, which doesn't compute the correct value if the passed value of
tm
isn't the current system time, i.e.localtime(::time())
(#3351).I suggest to fix this by changing the test to something like
The text was updated successfully, but these errors were encountered: