From: Michael R Sweet Date: Mon, 15 Apr 2024 19:02:37 +0000 (-0400) Subject: Address clang warning. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc49ff862cf54a1b0c14c89739a10deb7e829c90;p=thirdparty%2Fcups.git Address clang warning. --- diff --git a/scheduler/log.c b/scheduler/log.c index 78b11aaced..62a8e24aef 100644 --- a/scheduler/log.c +++ b/scheduler/log.c @@ -357,22 +357,28 @@ cupsdGetDateTime(struct timeval *t, /* I - Time value or NULL for current */ localtime_r(&(t->tv_sec), &date); +#ifdef HAVE_TM_GMTOFF if (format == CUPSD_TIME_STANDARD) snprintf(s, sizeof(s), "[%02d/%s/%04d:%02d:%02d:%02d %+03ld%02ld]", date.tm_mday, months[date.tm_mon], 1900 + date.tm_year, date.tm_hour, date.tm_min, date.tm_sec, -#ifdef HAVE_TM_GMTOFF date.tm_gmtoff / 3600, (date.tm_gmtoff / 60) % 60); -#else - timezone / 3600, (timezone / 60) % 60); -#endif /* HAVE_TM_GMTOFF */ else snprintf(s, sizeof(s), "[%02d/%s/%04d:%02d:%02d:%02d.%06d %+03ld%02ld]", date.tm_mday, months[date.tm_mon], 1900 + date.tm_year, date.tm_hour, date.tm_min, date.tm_sec, (int)t->tv_usec, -#ifdef HAVE_TM_GMTOFF date.tm_gmtoff / 3600, (date.tm_gmtoff / 60) % 60); + #else + if (format == CUPSD_TIME_STANDARD) + snprintf(s, sizeof(s), "[%02d/%s/%04d:%02d:%02d:%02d %+03ld%02ld]", + date.tm_mday, months[date.tm_mon], 1900 + date.tm_year, + date.tm_hour, date.tm_min, date.tm_sec, + timezone / 3600, (timezone / 60) % 60); + else + snprintf(s, sizeof(s), "[%02d/%s/%04d:%02d:%02d:%02d.%06d %+03ld%02ld]", + date.tm_mday, months[date.tm_mon], 1900 + date.tm_year, + date.tm_hour, date.tm_min, date.tm_sec, (int)t->tv_usec, timezone / 3600, (timezone / 60) % 60); #endif /* HAVE_TM_GMTOFF */ }