dovecot-1.0: utc_offset() was broken with year's first/last day ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jul 21 22:19:41 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.0/rev/9073f25d1b94
changeset: 5571:9073f25d1b94
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jul 21 15:18:49 2009 -0400
description:
utc_offset() was broken with year's first/last day if struct tm.tm_gmtoff didn't exist.

diffstat:

1 file changed, 4 insertions(+), 2 deletions(-)
src/lib/utc-offset.c |    6 ++++--

diffs (17 lines):

diff -r 9879434a6339 -r 9073f25d1b94 src/lib/utc-offset.c
--- a/src/lib/utc-offset.c	Thu Nov 06 15:35:37 2008 +0200
+++ b/src/lib/utc-offset.c	Tue Jul 21 15:18:49 2009 -0400
@@ -19,9 +19,11 @@ int utc_offset(struct tm *tm, time_t t _
 	gtm = *tm;
 
 	/* max offset of 24 hours */
-	if (ltm.tm_yday < gtm.tm_yday)
+	if ((ltm.tm_yday < gtm.tm_yday && ltm.tm_year == gtm.tm_year) ||
+	    ltm.tm_year < gtm.tm_year)
 		offset = -24 * 60;
-	else if (ltm.tm_yday > gtm.tm_yday)
+	else if ((ltm.tm_yday > gtm.tm_yday && ltm.tm_year == gtm.tm_year) ||
+		 ltm.tm_year > gtm.tm_year)
 		offset = 24 * 60;
 	else
 		offset = 0;


More information about the dovecot-cvs mailing list