Skip to content

Commit

Permalink
wdc: On FreeBSD, get the timezone the same as with real glibc
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bsdimp committed Mar 8, 2025
1 parent 48ff213 commit 305ccf9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/wdc/wdc-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 305ccf9

Please sign in to comment.