From: Warner Losh Date: Sat, 8 Mar 2025 05:56:54 +0000 (-0700) Subject: wdc: On FreeBSD, get the timezone the same as with real glibc X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=81c8f26c35aeaaf5af9417ec2656fc52b5d76cbe;p=users%2Fsagi%2Fnvme-cli.git 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 --- diff --git a/plugins/wdc/wdc-utils.c b/plugins/wdc/wdc-utils.c index 1b52e7c0..3b1f325f 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);