aboutsummaryrefslogtreecommitdiffstats
path: root/smtpd/to.c
diff options
context:
space:
mode:
authorgilles <gilles@poolp.org>2016-05-22 13:16:57 +0200
committergilles <gilles@poolp.org>2016-05-22 13:16:57 +0200
commite605d7a9c1a47ac7f2fcafcceb37734f402aa20c (patch)
tree8e43738d3e432732cc62472069b8355a62433d17 /smtpd/to.c
parentMerge branch 'portable' of ssh://ssh.poolp.org/git/opensmtpd into portable (diff)
parentsync with OpenBSD: (diff)
downloadOpenSMTPD-e605d7a9c1a47ac7f2fcafcceb37734f402aa20c.tar.xz
OpenSMTPD-e605d7a9c1a47ac7f2fcafcceb37734f402aa20c.zip
Merge branch 'master' into portable
Diffstat (limited to 'smtpd/to.c')
-rw-r--r--smtpd/to.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/smtpd/to.c b/smtpd/to.c
index 93490fc8..d4a6fbed 100644
--- a/smtpd/to.c
+++ b/smtpd/to.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: to.c,v 1.26 2016/02/15 12:53:50 mpi Exp $ */
+/* $OpenBSD: to.c,v 1.27 2016/05/22 11:15:31 gilles Exp $ */
/*
* Copyright (c) 2009 Jacek Masiulaniec <jacekm@dobremiasto.net>
@@ -200,21 +200,26 @@ time_to_text(time_t when)
char *day[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
char *month[] = {"Jan","Feb","Mar","Apr","May","Jun",
"Jul","Aug","Sep","Oct","Nov","Dec"};
+ char *tz;
+ long offset;
lt = localtime(&when);
if (lt == NULL || when == 0)
fatalx("time_to_text: localtime");
+ offset = lt->tm_gmtoff;
+ tz = lt->tm_zone;
+
/* We do not use strftime because it is subject to locale substitution*/
if (!bsnprintf(buf, sizeof(buf),
"%s, %d %s %d %02d:%02d:%02d %c%02d%02d (%s)",
day[lt->tm_wday], lt->tm_mday, month[lt->tm_mon],
lt->tm_year + 1900,
lt->tm_hour, lt->tm_min, lt->tm_sec,
- lt->tm_gmtoff >= 0 ? '+' : '-',
- abs((int)lt->tm_gmtoff / 3600),
- abs((int)lt->tm_gmtoff % 3600) / 60,
- lt->tm_zone))
+ offset >= 0 ? '+' : '-',
+ abs((int)offset / 3600),
+ abs((int)offset % 3600) / 60,
+ tz))
fatalx("time_to_text: bsnprintf");
return buf;