all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Eli Zaretskii'" <eliz@gnu.org>
Cc: bug-gnu-emacs@gnu.org
Subject: bug#641: format-time-string %Z does not work, starting with Emacs 22.2
Date: Tue, 5 Aug 2008 16:54:32 -0700	[thread overview]
Message-ID: <008601c8f756$9bce0f00$0200a8c0@us.oracle.com> (raw)
In-Reply-To: <uwsivjop0.fsf@gnu.org>

> > > 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.

OK, call it an incompatible change, if you prefer. You intentionally broke
existing code and reduced the utility of the function and the fidelity of its
doc string and Elisp doc. 

Count me as one user who disagrees with the change, whether bug or by design.
Not only does it break my existing code, but I don't see any way now to get a
timezone name (on Windows) even by changing the code. Can you tell me how to do
that? If so, please document it.
 
> > 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.

So? What requires `format-time-string' to use only Posix- or RFC-822 specs?

* The doc string says nothing about Posix or RFC-822.
  The Elisp manual is just as silent about this.

* The function previously DTRT for %Z, at least on Windows.

* The doc string still refers to %Z as producing the timezone name, and "" is
surely not a timezone name (for humans, even if it is for Posix). I'd call that,
in itself, a bug - at the very least, a doc bug. Or did you also intentionally
make the doc speak against the behavior?

* The Elisp manual says that %Z produces "the time zone abbreviation (e.g.,
`EST')", which is different from what the doc string says ("name" vs
"abbreviation"), and which is apparently also wrong. In Emacs 22, I get "Pacific
Daylight Time", not "PDT" (on Windows).

* %Z producing "" is less useful (not useful at all, in my eyes) for most
purposes, even if it is a Posix- or RFC-822 compliant timezone spec.

> 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.

The doc string does not mention this. And it does not refer the reader to the
Posix spec (which would be only slightly more help than saying nothing).

AFAICT, the functionality and usefulness has been reduced. At least on Windows,
IIUC, one can no longer use %Z - you just get "", which is useless. This is
strictly a loss, whatever plusses elsewhere might be seen to compensate it.

If you absolutely need a Posix-compliant spec for some use (e.g. mail), why
don't you add a new one - %P, for instance, instead of changing the meaning and
behavior of the existing %Z and thus introducing incompatibility? We didn't
change the Emacs regexp syntax when we introduced Posix regexp support - we
added separate Posix functions (that's TRT).

IIUC, you offer Windows users no way to get a timezone name now. You certainly
don't offer the *same* way to do that, so even if there is a way (is there?), it
means needing different code for different Emacs versions.

Are you really convinced this is TRT?









  reply	other threads:[~2008-08-05 23:54 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-04 21:24 bug#641: format-time-string %Z does not work, starting with Emacs 22.2 martin rudalics
2008-08-04 22:07 ` Drew Adams
2008-08-05  6:28   ` martin rudalics
2008-08-05 18:34   ` Eli Zaretskii
2008-08-05 23:54     ` Drew Adams [this message]
2008-08-06  3:22       ` Eli Zaretskii
2008-08-06  5:40         ` Drew Adams
2008-08-06 18:53           ` Eli Zaretskii
2008-08-06 19:48             ` Drew Adams
2008-08-06 20:34               ` Juanma Barranquero
2008-08-06 23:05                 ` Drew Adams
2008-08-07  3:16                   ` Juanma Barranquero
     [not found]           ` <mailman.15951.1218049658.18990.bug-gnu-emacs@gnu.org>
2008-08-06 19:53             ` Ted Zlatanov
2008-08-06 21:20               ` Eli Zaretskii
2008-08-06 21:35               ` Juanma Barranquero
     [not found]               ` <mailman.15962.1218059257.18990.bug-gnu-emacs@gnu.org>
2008-08-07 13:20                 ` Ted Zlatanov
2008-08-07 18:20                   ` Eli Zaretskii
2008-08-07 18:51                     ` Lennart Borgman (gmail)
2008-08-07 18:59                       ` Eli Zaretskii
2008-08-07 20:14                         ` Lennart Borgman (gmail)
2008-08-07 20:29                           ` Eli Zaretskii
2008-08-07 20:36                             ` Lennart Borgman (gmail)
2008-08-07 20:58                               ` Juanma Barranquero
2008-08-07 21:04                                 ` Lennart Borgman (gmail)
2008-08-07 21:13                                   ` Juanma Barranquero
2008-08-07 21:31                                     ` Lennart Borgman (gmail)
2008-08-08  7:10                                       ` Eli Zaretskii
     [not found]                                       ` <mailman.16075.1218180793.18990.bug-gnu-emacs@gnu.org>
2008-08-08 15:04                                         ` Ted Zlatanov
2008-08-08 15:57                                           ` Drew Adams
2008-08-08 17:22                                             ` Eli Zaretskii
2008-08-08 17:27                                               ` Drew Adams
2008-08-09  1:00                                                 ` OFFICE ZERO
2008-08-09 14:13                                                 ` OFFICE ZERO
2008-08-08 18:46                                               ` Stefan Monnier
2008-08-09  0:59                                               ` OFFICE ZERO
2008-08-08 18:47                                             ` Andreas Schwab
2008-08-09  1:01                                               ` OFFICE ZERO
2008-08-09 14:13                                               ` OFFICE ZERO
2008-08-09  1:01                                             ` OFFICE ZERO
2008-08-08 17:16                                           ` Eli Zaretskii
2008-08-09 14:12                                             ` OFFICE ZERO
2008-08-08  7:21                                   ` Eli Zaretskii
2008-08-07 21:47                                 ` Drew Adams
2008-08-07 21:20                         ` martin rudalics
2008-08-08  7:17                           ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2008-08-01 16:45 Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='008601c8f756$9bce0f00$0200a8c0@us.oracle.com' \
    --to=drew.adams@oracle.com \
    --cc=641@emacsbugs.donarmstrong.com \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.