GNU bug report logs -
#641
format-time-string %Z does not work, starting with Emacs 22.2
Previous Next
Reported by: "Drew Adams" <drew.adams <at> oracle.com>
Date: Fri, 1 Aug 2008 16:55:06 UTC
Severity: wishlist
Merged with 9794
Found in versions 22.2, 23.0.60, 24.0.90
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #31 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
> From: "Drew Adams" <drew.adams <at> 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 <at> 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.
This bug report was last modified 13 years and 270 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.