도원철
2009-Jul-21 07:08 UTC
[Dovecot] Problem with INTERNALDATE when the year in localtime and GMT different
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?
Timo Sirainen
2009-Jul-21 19:24 UTC
[Dovecot] Problem with INTERNALDATE when the year in localtime and GMT different
On Tue, 2009-07-21 at 16:08 +0900, ??? wrote:> In my thought utc_offset function in src/lib/utc-offset.c returns wrong > offset value when the year in localtime and GMT different...> I think this code should be modified as followings.Thanks, committed to hg. And I forgot to mention your name (well, email) in the commit message, sorry about that. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20090721/2ba07269/attachment-0002.bin>
Apparently Analagous Threads
- POSIXlt, POSIXct, strptime, GMT and 1969-12-31 23:59:59
- bug and patch: strptime first-of-month error in (possibly unsupported use of) "%j" format (PR#9577)
- [PATCH] Avoiding Dereferencing of NULL pointer
- 3 commits - libswfdec/swfdec_as_date.c libswfdec/swfdec_as_interpret.c libswfdec/swfdec_movie.c libswfdec/swfdec_movie.h libswfdec/swfdec_sprite_movie.c
- dnsupdate failed with TKEY is unaceptable