GNU bug report logs - #15816
24.3; (format-time-string "%h") returns "" instead of month

Previous Next

Package: emacs;

Reported by: andrea.rossetti <at> gmail.com

Date: Wed, 6 Nov 2013 00:07:01 UTC

Severity: minor

Found in version 24.3

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15816 in the body.
You can then email your comments to 15816 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#15816; Package emacs. (Wed, 06 Nov 2013 00:07:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to andrea.rossetti <at> gmail.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 06 Nov 2013 00:07:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: andrea.rossetti <at> gmail.com
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; (format-time-string "%h") returns "" instead of month
Date: Wed, 06 Nov 2013 01:05:45 +0100
Hello,

  when I execute 

(format-time-string "%h")

I get a return value of "" instead of "nov" meaning
November, the current date month. On the contrary,
execution of

(format-time-string "%b")

correctly returns "nov". I suppose this is
due to the runtime of my Windows installation
(an ordinary Windows 7 64-bit) not supporting
C99 format modifiers of the C function "strftime".

  My conjecture came after reading of this page:
http://www.cplusplus.com/reference/ctime/strftime/ .

  I kindly ask if someone good-willed Emacs user
might see if the problem happens on his/her
Windows machine. A test on Linux could be also
a useful counterexample.

  If it affects other users too, my suggestion is to
simply add a note in the docstring of format-time-string,
saying that modifier "%h" requires a C99-compliant
runtime. 

  Thanks for your attention, kindest regards.

  Andrea




In GNU Emacs 24.3.1 (i386-mingw-nt6.1.7600)
 of 2013-03-17 on MARVIN
Windowing system distributor `Microsoft Corp.', version 6.1.7600
Configured using:
 `configure --with-gcc (4.7) --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include
 -ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include
 -ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2'

Important settings:
  value of $LANG: ITA
  locale-coding-system: cp1252
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
w h e n SPC e x e c u t i n g SPC w i t h SPC C - j 
SPC I SPC g e t SPC " " SPC i n s t e a d SPC o f SPC 
" n o v " : <return> <return> ( f o r m a t - t i m 
e - s t r i n g SPC " % h " ) C-j <return> <return> 
<return> " % b " SPC w o r k s SPC f o r SPC m e : 
<return> <return> ( f o r m a t - t i m e - s t r i 
n g SPC " % b " ) C-j O K : SPC I SPC g o t SPC " n 
o v " SPC a s SPC r e s u l t <return> <return> M-x 
r e p o r <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
scroll-up-command: End of buffer

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel dos-w32 ls-lisp w32-common-fns disp-table w32-win
w32-vars tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
w32 multi-tty emacs)








Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15816; Package emacs. (Wed, 06 Nov 2013 00:49:01 GMT) Full text and rfc822 format available.

Message #8 received at 15816 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: andrea.rossetti <at> gmail.com
Cc: 15816 <at> debbugs.gnu.org
Subject: Re: bug#15816: 24.3;
 (format-time-string "%h") returns "" instead of month
Date: Tue, 05 Nov 2013 19:48:06 -0500
> (format-time-string "%h")
> I get a return value of "" instead of "nov" meaning

I get "nov" here under GNU/Linux.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15816; Package emacs. (Wed, 06 Nov 2013 06:47:02 GMT) Full text and rfc822 format available.

Message #11 received at 15816 <at> debbugs.gnu.org (full text, mbox):

From: Bastien <bzg <at> altern.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: andrea.rossetti <at> gmail.com, 15816 <at> debbugs.gnu.org
Subject: Re: bug#15816: 24.3;
 (format-time-string "%h") returns "" instead of month
Date: Wed, 06 Nov 2013 07:46:18 +0100
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> (format-time-string "%h")
>> I get a return value of "" instead of "nov" meaning
>
> I get "nov" here under GNU/Linux.

If I may chim in: someone reported the same problem on the orgmode
list, this seems limited to Windows users.

By the way, the docstring of `format-time-string' suggests that
%b and %h are equivalent: is there a difference?

-- 
 Bastien




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15816; Package emacs. (Wed, 06 Nov 2013 10:17:01 GMT) Full text and rfc822 format available.

Message #14 received at 15816 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Bastien <bzg <at> altern.org>
Cc: andrea.rossetti <at> gmail.com, 15816 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#15816: 24.3;
 (format-time-string "%h") returns "" instead of month
Date: Wed, 06 Nov 2013 12:16:26 +0200
> From: Bastien <bzg <at> altern.org>
> Date: Wed, 06 Nov 2013 07:46:18 +0100
> Cc: andrea.rossetti <at> gmail.com, 15816 <at> debbugs.gnu.org
> 
> By the way, the docstring of `format-time-string' suggests that
> %b and %h are equivalent: is there a difference?

Not AFAIK.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Wed, 06 Nov 2013 10:17:02 GMT) Full text and rfc822 format available.

Notification sent to andrea.rossetti <at> gmail.com:
bug acknowledged by developer. (Wed, 06 Nov 2013 10:17:03 GMT) Full text and rfc822 format available.

Message #19 received at 15816-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: andrea.rossetti <at> gmail.com
Cc: 15816-done <at> debbugs.gnu.org
Subject: Re: bug#15816: 24.3;
 (format-time-string "%h") returns "" instead of month
Date: Wed, 06 Nov 2013 12:16:00 +0200
> From: andrea.rossetti <at> gmail.com
> Date: Wed, 06 Nov 2013 01:05:45 +0100
> 
>   when I execute 
> 
> (format-time-string "%h")
> 
> I get a return value of "" instead of "nov" meaning
> November, the current date month. On the contrary,
> execution of
> 
> (format-time-string "%b")
> 
> correctly returns "nov". I suppose this is
> due to the runtime of my Windows installation
> (an ordinary Windows 7 64-bit) not supporting
> C99 format modifiers of the C function "strftime".

Indeed, Windows version of strftime doesn't support %h.

>   If it affects other users too, my suggestion is to
> simply add a note in the docstring of format-time-string,
> saying that modifier "%h" requires a C99-compliant
> runtime. 

Done.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15816; Package emacs. (Wed, 06 Nov 2013 13:32:02 GMT) Full text and rfc822 format available.

Message #22 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
To: bug-gnu-emacs <at> gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Cc: andrea.rossetti <at> gmail.com, 15816-done <at> debbugs.gnu.org
Subject: Re: bug#15816: 24.3;
 (format-time-string "%h") returns "" instead of month
Date: Wed, 06 Nov 2013 14:31:04 +0100
On Wednesday 06 November 2013 12:16:00 Eli Zaretskii wrote:
> > From: andrea.rossetti <at> gmail.com
> > Date: Wed, 06 Nov 2013 01:05:45 +0100

> > correctly returns "nov". I suppose this is
> > due to the runtime of my Windows installation
> > (an ordinary Windows 7 64-bit) not supporting
> > C99 format modifiers of the C function "strftime".
> 
> Indeed, Windows version of strftime doesn't support %h.

I just compared the docstring to the manpage of strftime on GNU/Linux and the 
following symbols are not  ANSI C

- %C is SU
- %G,%g are TZ
- %h is SU (%b)
- %e is SU (%d with blanks)
- %u is SU
- %V is SU
- %k is TZ (%H with blanks)
- %l is TZ (%I with blanks)
- %N not in manpage or glibc manual
- %z is SU
- %s is TZ
- %D is SU ("%m/%d/%y", should not be used)
- %T is SU ("%H:%M:%S")
- %R is SU ("%H:%M")
- %r is SU ("%I:%M:%S %p")
- %t is SU (\t)
- %n is SU (\n)

(SU :: Single UNIX Specification and TZ :: Olson's timezone package)

Maybe we should not mention %h, %D, %T, %R, %r, %t, %n at all because these 
can be replaced by the portable alternatives mentioned.  The rest might be a 
bit tricky to replace.  Could you try which of them work on Windows at all?  
(Sorry I don't have a current Windows Emacs available.)

There are also %F in C99 (ISO 8601 date format) and %P (GNU extension, am/pm), 
which are not mentioned in the docstring right now.

Regards,
Rüdiger




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15816; Package emacs. (Wed, 06 Nov 2013 13:32:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15816; Package emacs. (Wed, 06 Nov 2013 16:55:02 GMT) Full text and rfc822 format available.

Message #28 received at 15816 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> suse.de>
To: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
Cc: 15816-done <at> debbugs.gnu.org, eliz <at> gnu.org, 15816 <at> debbugs.gnu.org,
 andrea.rossetti <at> gmail.com
Subject: Re: bug#15816: 24.3;
 (format-time-string "%h") returns "" instead of month
Date: Wed, 06 Nov 2013 15:16:27 +0100
Rüdiger Sonderfeld <ruediger <at> c-plusplus.de> writes:

> I just compared the docstring to the manpage of strftime on GNU/Linux and the 
> following symbols are not  ANSI C

C11 has all of them (execpt %k, %l, %N, %s).

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15816; Package emacs. (Wed, 06 Nov 2013 16:55:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15816; Package emacs. (Wed, 06 Nov 2013 17:13:01 GMT) Full text and rfc822 format available.

Message #34 received at 15816 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
Cc: 15816-done <at> debbugs.gnu.org, eliz <at> gnu.org, 15816 <at> debbugs.gnu.org,
 andrea.rossetti <at> gmail.com
Subject: Re: bug#15816: 24.3;
 (format-time-string "%h") returns "" instead of month
Date: Wed, 06 Nov 2013 12:12:21 -0500
> (Sorry I don't have a current Windows Emacs available.)

Not to encourage you to use the Windows version of Emacs, but I remember
once having to debug a problem where the only recipe was on Windows, and
being able to run Windows Emacs inside Wine (not perfectly, but good
enough to track the problem down).


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15816; Package emacs. (Wed, 06 Nov 2013 17:13:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15816; Package emacs. (Wed, 06 Nov 2013 17:28:01 GMT) Full text and rfc822 format available.

Message #40 received at 15816 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
Cc: andrea.rossetti <at> gmail.com, 15816 <at> debbugs.gnu.org
Subject: Re: bug#15816: 24.3;
 (format-time-string "%h") returns "" instead of month
Date: Wed, 06 Nov 2013 19:26:56 +0200
> From: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
> Cc: andrea.rossetti <at> gmail.com, 15816-done <at> debbugs.gnu.org
> Date: Wed, 06 Nov 2013 14:31:04 +0100
> 
> I just compared the docstring to the manpage of strftime on GNU/Linux and the 
> following symbols are not  ANSI C
> 
> - %C is SU
> - %G,%g are TZ
> - %h is SU (%b)
> - %e is SU (%d with blanks)
> - %u is SU
> - %V is SU
> - %k is TZ (%H with blanks)
> - %l is TZ (%I with blanks)
> - %N not in manpage or glibc manual
> - %z is SU
> - %s is TZ
> - %D is SU ("%m/%d/%y", should not be used)
> - %T is SU ("%H:%M:%S")
> - %R is SU ("%H:%M")
> - %r is SU ("%I:%M:%S %p")
> - %t is SU (\t)
> - %n is SU (\n)
> 
> (SU :: Single UNIX Specification and TZ :: Olson's timezone package)
> 
> Maybe we should not mention %h, %D, %T, %R, %r, %t, %n at all because these 
> can be replaced by the portable alternatives mentioned.  The rest might be a 
> bit tricky to replace.  Could you try which of them work on Windows at all?  
> (Sorry I don't have a current Windows Emacs available.)

All of them are supported, with the single exception of %r.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15816; Package emacs. (Sat, 16 Nov 2013 00:02:02 GMT) Full text and rfc822 format available.

Message #43 received at 15816 <at> debbugs.gnu.org (full text, mbox):

From: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: andrea.rossetti <at> gmail.com, 15816 <at> debbugs.gnu.org
Subject: Re: bug#15816: 24.3;
 (format-time-string "%h") returns "" instead of month
Date: Sat, 16 Nov 2013 01:01:32 +0100
On Wednesday 06 November 2013 19:26:56 Eli Zaretskii wrote:
> All of them are supported, with the single exception of %r.

I'd suggest documenting %F then.  It is the date format for ISO 8601.

-- 8< ---------------------------------------------------------- >8 --

* editfns.c (Fformat_time_string): Doc fix.  (Bug#15816)

---
 src/ChangeLog | 4 ++++
 src/editfns.c | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 4c3811d..7921b96 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2013-11-16  Rüdiger Sonderfeld  <ruediger <at> c-plusplus.de>
+
+	* editfns.c (Fformat_time_string): Doc fix.  (Bug#15816)
+
 2013-11-15  Paul Eggert  <eggert <at> cs.ucla.edu>
 
 	* data.c: Work around bogus GCC diagnostic about shift count.
diff --git a/src/editfns.c b/src/editfns.c
index 277e5b6..f17b02a 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1722,6 +1722,7 @@ TIME is specified as (HIGH LOW USEC PSEC), as returned by
 %c is the locale's date and time format.
 %x is the locale's "preferred" date format.
 %D is like "%m/%d/%y".
+%F is the ISO 8601 date format (like "%Y-%m-%d").
 
 %R is like "%H:%M", %T is like "%H:%M:%S", %r is like "%I:%M:%S %p".
 %X is the locale's "preferred" time format.
@@ -1740,7 +1741,7 @@ but takes up at least N (a number) positions.
 %EX is a locale's alternative version of %X;
 %OX is like %X, but uses the locale's number symbols.
 
-For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z".
+For example, to produce full ISO 8601 format, use "%FT%T%z".
 
 usage: (format-time-string FORMAT-STRING &optional TIME UNIVERSAL)  */)
   (Lisp_Object format_string, Lisp_Object timeval, Lisp_Object universal)
-- 
1.8.4.2





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15816; Package emacs. (Wed, 11 Dec 2013 14:43:02 GMT) Full text and rfc822 format available.

Message #46 received at 15816 <at> debbugs.gnu.org (full text, mbox):

From: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: andrea.rossetti <at> gmail.com, 15816 <at> debbugs.gnu.org
Subject: Re: bug#15816: 24.3;
 (format-time-string "%h") returns "" instead of month
Date: Wed, 11 Dec 2013 15:42:10 +0100
Pushed the change to trunk.

Regards,
Rüdiger

On Saturday 16 November 2013 01:01:32 Rüdiger Sonderfeld wrote:
> On Wednesday 06 November 2013 19:26:56 Eli Zaretskii wrote:
> > All of them are supported, with the single exception of %r.
> 
> I'd suggest documenting %F then.  It is the date format for ISO 8601.
> 
> -- 8< ---------------------------------------------------------- >8 --
> 
> * editfns.c (Fformat_time_string): Doc fix.  (Bug#15816)
> 
> ---
>  src/ChangeLog | 4 ++++
>  src/editfns.c | 3 ++-
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/ChangeLog b/src/ChangeLog
> index 4c3811d..7921b96 100644
> --- a/src/ChangeLog
> +++ b/src/ChangeLog
> @@ -1,3 +1,7 @@
> +2013-11-16  Rüdiger Sonderfeld  <ruediger <at> c-plusplus.de>
> +
> +	* editfns.c (Fformat_time_string): Doc fix.  (Bug#15816)
> +
>  2013-11-15  Paul Eggert  <eggert <at> cs.ucla.edu>
> 
>  	* data.c: Work around bogus GCC diagnostic about shift count.
> diff --git a/src/editfns.c b/src/editfns.c
> index 277e5b6..f17b02a 100644
> --- a/src/editfns.c
> +++ b/src/editfns.c
> @@ -1722,6 +1722,7 @@ TIME is specified as (HIGH LOW USEC PSEC), as returned
> by %c is the locale's date and time format.
>  %x is the locale's "preferred" date format.
>  %D is like "%m/%d/%y".
> +%F is the ISO 8601 date format (like "%Y-%m-%d").
> 
>  %R is like "%H:%M", %T is like "%H:%M:%S", %r is like "%I:%M:%S %p".
>  %X is the locale's "preferred" time format.
> @@ -1740,7 +1741,7 @@ but takes up at least N (a number) positions.
>  %EX is a locale's alternative version of %X;
>  %OX is like %X, but uses the locale's number symbols.
> 
> -For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z".
> +For example, to produce full ISO 8601 format, use "%FT%T%z".
> 
>  usage: (format-time-string FORMAT-STRING &optional TIME UNIVERSAL)  */)
>    (Lisp_Object format_string, Lisp_Object timeval, Lisp_Object universal)





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 09 Jan 2014 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 120 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.