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

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


details:   http://hg.dovecot.org/dovecot-1.2/rev/8e66ca02b6f9
changeset: 9235:8e66ca02b6f9
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 ae3e0ff64c94 -r 8e66ca02b6f9 src/lib/utc-offset.c
--- a/src/lib/utc-offset.c	Tue Jul 21 15:01:05 2009 -0400
+++ 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 A
 	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