[Dovecot] Problem with INTERNALDATE when the year in localtime and GMT different

도원철 wdo at handysoft.co.kr
Tue Jul 21 10:08:53 EEST 2009


In my thought utc_offset function in src/lib/utc-offset.c returns wrong
offset value when the year in localtime and GMT different. 

/* max offset of 24 hours */ 
if (ltm.tm_yday < gtm.tm_yday) 
offset = -24 * 60; 
else if (ltm.tm_yday > gtm.tm_yday) 
offset = 24 * 60; 
else 
offset = 0; 

I think this code should be modified as followings. 

/* max offset of 24 hours */ 
if ((ltm.tm_year == gtm.tm_year && ltm.tm_yday < gtm.tm_yday) 
|| (ltm.tm_year < gtm.tm_year)) 
offset = -24 * 60; 
else if ((ltm.tm_year == gtm.tm_year && ltm.tm_yday > gtm.tm_yday) 
|| (ltm.tm_year > gtm.tm_year)) 
offset = 24 * 60; 
else 
offset = 0; 

On 1 Jan. 2009, I found an error related to this code. The intrenal date of
message recieved at 01-Jan-2009 07:17:38 was not display as it received.
The protocol log was as followings. 

FETCH (INTERNALDATE “01-Jan-2009 07:17:38 -3900” RFC822.SIZE 1597 FLAGS
(\Seen) ENVELOP (“Thu, 1 Jan 2009 07:17:38 +0900 (KST)” … 

The INTERNALDATE must be “01-Jan-2009 07:17:38 +0900”, but it was "01-Jan-
2009 07:17:38 -3900". This error may be caused by the bug in utc_offset.c. 

How do you think?



More information about the dovecot mailing list