diff --git a/meson.build b/meson.build index b4192495a6..02f6050604 100644 --- a/meson.build +++ b/meson.build @@ -176,6 +176,20 @@ conf.set10( ), description: 'Does struct opal_key have a key_type field?' ) +conf.set( + 'HAVE_TM_GMTOFF', + cc.compiles( + ''' + #include + int main(void) { + struct tm tm; + tm.tm_gmtoff = 1; + } + ''', + name: 'tm_gmtoff' + ), + description: 'Does struct tm have a tm_gmtoff field?' +) if cc.has_function_attribute('fallthrough') conf.set('fallthrough', '__attribute__((__fallthrough__))') diff --git a/plugins/wdc/wdc-utils.c b/plugins/wdc/wdc-utils.c index 31884990b7..9988ff1d12 100644 --- a/plugins/wdc/wdc-utils.c +++ b/plugins/wdc/wdc-utils.c @@ -81,11 +81,11 @@ 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__)) || defined(__FreeBSD__) +#ifdef HAVE_TM_GMTOFF timeInfo->zone = -currTimeInfo.tm_gmtoff / 60; -#else +#else /* HAVE_TM_GMTOFF */ timeInfo->zone = -1 * (timezone / SECONDS_IN_MIN); -#endif +#endif /* HAVE_TM_GMTOFF */ return WDC_STATUS_SUCCESS; }