From 305ccf9d628808e00e3de180f6fbb0db6b344656 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Fri, 7 Mar 2025 22:56:54 -0700 Subject: [PATCH] wdc: On FreeBSD, get the timezone the same as with real glibc FreeBSD 15 and newer finally has the timezone variable (prior it that was a compat function leftover from 4BSD). Older versions are still supported. Both have tm_gmoff, which I've always preferred for better portability. Signed-off-by: Warner Losh --- plugins/wdc/wdc-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/wdc/wdc-utils.c b/plugins/wdc/wdc-utils.c index 1b52e7c04a..3b1f325f9e 100644 --- a/plugins/wdc/wdc-utils.c +++ b/plugins/wdc/wdc-utils.c @@ -81,7 +81,7 @@ int wdc_UtilsGetTime(PUtilsTimeInfo timeInfo) timeInfo->second = currTimeInfo.tm_sec; timeInfo->msecs = 0; timeInfo->isDST = currTimeInfo.tm_isdst; -#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(__MUSL__) +#if (defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(__MUSL__)) || defined(__FreeBSD__) timeInfo->zone = -currTimeInfo.tm_gmtoff / 60; #else timeInfo->zone = -1 * (timezone / SECONDS_IN_MIN);