From: Vsevolod Stakhov Date: Wed, 4 Apr 2018 14:47:28 +0000 (+0100) Subject: [Fix] Stop using own localtime as DST could be messy in many cases X-Git-Tag: 1.7.3~34 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8f2c82211defdac42bf913af79e576af73ea7da6;p=rspamd.git [Fix] Stop using own localtime as DST could be messy in many cases --- diff --git a/src/libutil/util.c b/src/libutil/util.c index b6057f08d..6957c25bf 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -2770,36 +2770,12 @@ rspamd_gmtime (gint64 ts, struct tm *dest) dest->tm_zone = "GMT"; } -#ifdef HAVE_SANE_TZSET -extern char *tzname[2]; -extern long timezone; -extern int daylight; - -void rspamd_localtime (gint64 ts, struct tm *dest) -{ - static gint64 last_tzcheck = 0; - static const guint tz_check_interval = 120; - - if (ts - last_tzcheck > tz_check_interval) { - tzset (); - last_tzcheck = ts; - } - - ts -= timezone; - rspamd_gmtime (ts, dest); - dest->tm_zone = daylight ? (tzname[1] ? tzname[1] : tzname[0]) : tzname[0]; -#if !defined(__sun) - dest->tm_gmtoff = -timezone; -#endif -} - -#else -void rspamd_localtime (gint64 ts, struct tm *dest) +void +rspamd_localtime (gint64 ts, struct tm *dest) { time_t t = ts; localtime_r (&t, dest); } -#endif gboolean rspamd_fstring_gzip (rspamd_fstring_t **in)