summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/smtppass.c36
-rw-r--r--configure.in4
2 files changed, 35 insertions, 5 deletions
diff --git a/common/smtppass.c b/common/smtppass.c
index 6897aaa..0ea9ca5 100644
--- a/common/smtppass.c
+++ b/common/smtppass.c
@@ -1340,11 +1340,41 @@ static void make_date(spctx_t* ctx, char* date)
#ifdef HAVE_TM_GMTOFF
time_t timezone = t2.tm_gmtoff;
const char *tzname[2] = { t2.tm_zone, t2.tm_zone };
+
+ snprintf(date + date_len, MAX_DATE_LENGTH - date_len, " %+03d%02d (%s)",
+ (int)(timezone / 3600), (int)(timezone % 3600),
+ tzname[t2.tm_isdst ? 1 : 0]);
#else
- tzset();
+ /* Apparently Solaris needs this nasty hack.... */
+ #define DAY_MIN (24 * HOUR_MIN)
+ #define HOUR_MIN 60
+ #define MIN_SEC 60
+
+ struct tm gmt;
+ struct tm *lt;
+ int off;
+
+ gmt = *gmtime(&t);
+ lt = localtime(&t);
+ off = (lt->tm_hour - gmt.tm_hour) * HOUR_MIN + lt->tm_min - gmt.tm_min;
+
+ if (lt->tm_year < gmt.tm_year)
+ off -= DAY_MIN;
+ else if (lt->tm_year > gmt.tm_year)
+ off += DAY_MIN;
+ else if (lt->tm_yday < gmt.tm_yday)
+ off -= DAY_MIN;
+ else if (lt->tm_yday > gmt.tm_yday)
+ off += DAY_MIN;
+ if (lt->tm_sec <= gmt.tm_sec - MIN_SEC)
+ off -= 1;
+ else if (lt->tm_sec >= gmt.tm_sec + MIN_SEC)
+ off += 1;
+
+ snprintf(date + date_len, MAX_DATE_LENGTH - date_len,
+ " %+03d%02d (%s)", (int)(off / HOUR_MIN), (int)(abs(off) % HOUR_MIN),
+ tzname[lt->tm_isdst ? 1 : 0]);
#endif
- snprintf(date + date_len, MAX_DATE_LENGTH - date_len, " %+03d%02d (%s)",
- (int)(timezone / 3600), (int)(timezone % 3600), tzname[t2.tm_isdst ? 1 : 0]);
}
/* Break it off just in case */
diff --git a/configure.in b/configure.in
index 24c02f1..b492045 100644
--- a/configure.in
+++ b/configure.in
@@ -36,8 +36,8 @@ dnl Nate Nielsen <nielsen@memberwebs.com>
dnl
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(clamsmtp, 1.4.1.92, nielsen@memberwebs.com)
-AM_INIT_AUTOMAKE(clamsmtp, 1.4.1.92)
+AC_INIT(clamsmtp, 1.4.1.95, nielsen@memberwebs.com)
+AM_INIT_AUTOMAKE(clamsmtp, 1.4.1.95)
LDFLAGS="$LDFLAGS -L/usr/local/lib"
CFLAGS="$CFLAGS -I/usr/local/include"