Subject: bug#9794: 24.0.90; `format-time-string' no good for %Z

From: Jason Rumney <[email-masked]>
Date: Fri, 21 Oct 2011 23:40:20 +0800

Eli Zaretskii <[email-masked]> writes:

>>     Any code that assumes that (format-time-string "%Z") must generate
>>     an RFC822 zone is making an unwarranted assumption and should be
>>     fixed.
>
> Fixed how?  Given some arbitrary string, how can Lisp code check
> whether it is or isn't compliant?  Non-ASCII characters are easy to
> check, but what about time zones that include only ASCII characters?

Lisp code that needs RFC822 compliance should just use %z.  Only a small
subset of timezone abbreviations are allowed by RFC822:

zone        =  "UT"  / "GMT"                ; Universal Time
                                            ; North American : UT
            /  "EST" / "EDT"                ;  Eastern:  - 5/ - 4
            /  "CST" / "CDT"                ;  Central:  - 6/ - 5
            /  "MST" / "MDT"                ;  Mountain: - 7/ - 6
            /  "PST" / "PDT"                ;  Pacific:  - 8/ - 7
            /  1ALPHA                       ; Military: Z = UT;
                                            ;  A:-1; (J not used)
                                            ;  M:-12; N:+1; Y:+12
            / ( ("+" / "-") 4DIGIT )        ; Local differential
                                            ;  hours+min. (HHMM)

So Paul is probably correct - we should not worry about RFC / POSIX or
whatever compliance for %Z.

> Jason, can you point out which package(s) needed an RFC822-compliant
> time zone name?  In the mail exchange I found, you just say
>
>   [...] since the result of current-time-zone is used for mail
>   headers, where non-ASCII characters are not allowed, and the POSIX
>   timezone names are expected [...]

A translation of the original report is here:
 http://www.m17n.org/mlarchive/mule-ja/200102/msg00072.html

The original problem leading to that report seems to have been observed
in a beta version of mew:
 http://groups.yahoo.co.jp/group/emacs21-users-ja/message/42