[Users] A bug (?) in template %D{%Z} symbol expansion

pezcurrel pezcurrel at tiscali.it
Sat Nov 19 15:36:47 CET 2011


On Sat, 19 Nov 2011 13:48:59 +0100 Ricardo Mones <ricardo at mones.org> wrote:

> On Sat, 19 Nov 2011 13:34:22 +0100
> Colin Leroy <colin at colino.net> wrote:
> 
> > On 19 November 2011 at 11h45, pezcurrel wrote:
> > 
> > Hi, 
> > 
> > > Hello,
> > > 
> > > if I set a reply template like this...
> > > 
> > > On %D{%d/%m/%Y %H:%M (%Z)}...
> > > 
> > > ...and reply to a mail with a date of "Fri, 18 Nov 2011 12:15:41
> > > -0500", while my timezone is +0100, I'll get...
> > > 
> > > On 18/11/2011 12:15 (CET)...
> > > 
> > > ...in my reply, but that "18/11/2011 12:15" is not "CET".
> > > 
> > > This happens with claws-mail 3.7.10 from claws-mail ppa on ubuntu
> > > 10.04. A template like this...
> > > 
> > > On %D{%d/%m/%Y %H:%M (%z)}...
> > > 
> > > ...would instead produce...
> > > 
> > > On 18/11/2011 12:15 (-0500)...
> > > 
> > > ...which is right.
> > 
> > It looks like a strftime() bug. date gives me the same:
> > 
> > colin at marv:~/docs/cvs/claws$ date +'%Z'
> > CET
> > colin at marv:~/docs/cvs/claws$ date +'%z'
> > +0100
> 
>   This is correct from strftime as you're in CET,

Yes.

>   but I think the OP
>   refers the date on the mail belongs to a different TZ (-0500)

Yes.

>   but CM
>   is not parsing it or is parsing it incorrectly

I don't know if it's CM or/and strftime(), since I think colin's test doesn't prove anything (see below).

>   and, as no timezone
>   correction is applied to time, when generated with local timezone is
>   not modified and therefore wrong (12:15 -0500 should be 06:15 CET).

The problem I issued is not the lack of timezone conversion (although that could be a nice template feature - symbol - to _add_); the problem is that, given that there is no conversion, "%D{%d/%m/%Y %H:%M (%Z)}" should print "18/11/2011 12:15 (EST)" or something like that (there are many different zones and acronyms with a timeshift of "-0500" from GMT, see below), but surely not "18/11/2011 12:15 (CET)".

I guess the problem may be that strftime() nor any program can tell the exact tz acronym from the common "Date" header format, since it often only reports the timeshift from GMT, and (eg) "-0500" alone could be CDT (Central Daylight Time, North America), CST (Cuba Standard Time, Caribbean), PET (Peru Time, South America), EST (Eastern Standard Time, Australia|Central America|Caribbean|North America --- this being the most generic one, I think)... see:

http://www.timeanddate.com/library/abbreviations/timezones/

Anyway, some mailers add the acronym to the "Date" header, eg "Wed, 16 Nov 2011 07:43:05 -0800 (PST)", but even in these cases claws reports the local tz for %Z.

I think claws and/or strftime() should behave this way for %Z:

- if the "Date" header reports the acronym, print it
- if it doesn't
  - print the generic acronym for the given timeshift, like "EST" for "-0500", but I don't know if it's defined/definable somehow and in all cases, and if it's in all cases generic enough to cover all the different specific zones so...
  - if "the most generic acronym for a timeshift" is undefined/undefineable or "not generic enough", print something like (eg) "UTC-5" or "GMT-5" for "-0500"

@colin:

$ date "+%c %z" && TZ="America/Bogota" date "+%c %z"
sab 19 nov 2011 15:06:33 CET +0100
sab 19 nov 2011 09:06:33 COT -0500

COT is Colombia Time, and it is told from TZ="America/Bogota"...

http://cr.yp.to/immhf/date.html seems to me to give a some more clarity on the subject.

Regards



More information about the Users mailing list