]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
wdc: On FreeBSD, get the timezone the same as with real glibc
authorWarner Losh <imp@bsdimp.com>
Sat, 8 Mar 2025 05:56:54 +0000 (22:56 -0700)
committerDaniel Wagner <wagi@monom.org>
Mon, 17 Mar 2025 09:03:34 +0000 (10:03 +0100)
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 <imp@bsdimp.com>
plugins/wdc/wdc-utils.c

index 1b52e7c04acdbcb3819a261e9d6b83bd58d79fa0..3b1f325f9e27245f8bcc4d1640e5d5813213bf5e 100644 (file)
@@ -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);