bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#641: format-time-string %Z does not work, starting with Emacs 22.2


From: Eli Zaretskii
Subject: bug#641: format-time-string %Z does not work, starting with Emacs 22.2
Date: Tue, 05 Aug 2008 21:34:35 +0300

> From: "Drew Adams" <drew.adams@oracle.com>
> Date: Mon, 4 Aug 2008 15:07:28 -0700
> Cc: 
> 
> > From: martin rudalics Sent: Monday, August 04, 2008 2:24 PM
> >  > emacs -Q
> >  > M-: (format-time-string "%Z) ==> ""
> >  > M-: (format-time-string "%z) ==> "-0700"
> >  >
> >  > The %Z string is incorrect. In my case, it should be (as it is in
> >  > Emacs 20 and Emacs 22.1): "Pacific Daylight Time".
> >  >
> >  > This same bug appears in Emacs 23.  This is a regression from Emacs
> >  > 22.1.
> > 
> > See
> > 2007-06-07  Jason Rumney  <jasonr@gnu.org>
> >     * s/ms-w32.h: Don't define HAVE_TZNAME.
> >     * editfns.c (Fcurrent_time_zone): Remove hack for 
> >       Japanese Windows.
> > 
> > and the preceding discussion starting with
> > http://lists.gnu.org/archive/html/emacs-devel/2007-06/msg00334.html
> 
> Sorry; I don't know what all of that means.

What it means is that we did this on purpose, and therefore the fact
you get an empty string for %Z is not a bug.

> It is obviously a bug, however, that %Z produces an empty time-zone string. I
> use it for a time stamp, for instance, with this form:
>  (format-time-string "%a %b %e %T %Y (%Z)")
> 
> After the change that introduced the bug, I get this:
> 
> Mon Aug  4 15:01:16 2008 ()
> 
> instead of this:
> 
> Mon Aug  4 15:01:16 2008 (Pacific Daylight Time)

"Pacific Daylight Time" is not a Posix- or RFC-822 compliant timezone
specification.  It comes from the MS-Windows version of `tzname',
which produces RFC-compliant TZ strings only for a very small subset
of timezone specifications, and even that only after you call `tzset'
from within an application.  So we disabled the use of `tzname' on
Windows to avoid producing non-compliant timezone strings, which could
break others, e.g. if used in an email message header.

Posix specifies that if `tzname' is not available, %Z should produce
an empty string.  This means that an empty string is a valid result of
format-time-string for %Z, and if you use %Z in your Lisp code, you
should make allowances for the case of an empty string, no matter on
which platform.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]