aboutsummaryrefslogtreecommitdiffstats
path: root/smtpd/to.c
diff options
context:
space:
mode:
authorgilles <gilles@poolp.org>2016-05-22 13:19:25 +0200
committergilles <gilles@poolp.org>2016-05-22 13:19:25 +0200
commit792cf029e57e978af6d9ab359d5b4af5788f397e (patch)
tree266a67374e7f021a75526c52273f1c9bceeaa584 /smtpd/to.c
parentMerge branch 'master' into portable (diff)
parentSome Os (as Solaris) don't have member tm_gmtoff in struct tm (diff)
downloadOpenSMTPD-792cf029e57e978af6d9ab359d5b4af5788f397e.tar.xz
OpenSMTPD-792cf029e57e978af6d9ab359d5b4af5788f397e.zip
Merge branch 'solaris_struct_tm' of https://github.com/bsdsx/OpenSMTPD into bsdsx-solaris_struct_tm
Diffstat (limited to 'smtpd/to.c')
-rw-r--r--smtpd/to.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/smtpd/to.c b/smtpd/to.c
index d4a6fbed..2eceb5e7 100644
--- a/smtpd/to.c
+++ b/smtpd/to.c
@@ -207,8 +207,13 @@ time_to_text(time_t when)
if (lt == NULL || when == 0)
fatalx("time_to_text: localtime");
+#if HAVE_STRUCT_TM_TM_GMTOFF
offset = lt->tm_gmtoff;
tz = lt->tm_zone;
+#elif defined HAVE_DECL_ALTZONE && defined HAVE_DECL_TIMEZONE
+ offset = lt->tm_isdst > 0 ? altzone : timezone;
+ tz = lt->tm_isdst > 0 ? tzname[1] : tzname[0];
+#endif
/* We do not use strftime because it is subject to locale substitution*/
if (!bsnprintf(buf, sizeof(buf),