changeset 5685:aa5f38ecb804

Accept GNU's UNIVERSAL argument to #'format-time-string. src/ChangeLog addition: 2012-09-16 Aidan Kehoe <kehoea@parhasard.net> * editfns.c (Fformat_time_string): Accept GNU's UNIVERSAL argument, which means we call gmtime() instead of localtime(). Thanks for the report of org-mode incompatibility, Matsl!
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 16 Sep 2012 21:43:21 +0100
parents 0eb4e96fd261
children c6b1500299a7
files src/ChangeLog src/editfns.c
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sat Sep 08 16:33:48 2012 +0100
+++ b/src/ChangeLog	Sun Sep 16 21:43:21 2012 +0100
@@ -1,3 +1,10 @@
+2012-09-16  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* editfns.c (Fformat_time_string):
+	Accept GNU's UNIVERSAL argument, which means we call gmtime()
+	instead of localtime(). Thanks for the report of org-mode
+	incompatibility, Matsl!
+
 2012-09-07  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* file-coding.c:
--- a/src/editfns.c	Sat Sep 08 16:33:48 2012 +0100
+++ b/src/editfns.c	Sun Sep 16 21:43:21 2012 +0100
@@ -998,11 +998,13 @@
 static long difftm (const struct tm *a, const struct tm *b);
 
 
-DEFUN ("format-time-string", Fformat_time_string, 1, 2, 0, /*
+DEFUN ("format-time-string", Fformat_time_string, 1, 3, 0, /*
 Use FORMAT-STRING to format the time TIME.
 TIME is specified as (HIGH LOW . IGNORED) or (HIGH . LOW), as from
 `current-time' and `file-attributes'.  If TIME is not specified it
 defaults to the current time.
+The third, optional, argument UNIVERSAL, if non-nil, means describe TIME
+as Universal Time; nil means describe TIME in the local time zone.
 FORMAT-STRING may contain %-sequences to substitute parts of the time.
 %a is replaced by the abbreviated name of the day of week.
 %A is replaced by the full name of the day of week.
@@ -1047,7 +1049,7 @@
 
 The number of options reflects the `strftime' function.
 */
-       (format_string, time_))
+       (format_string, time_, universal))
 {
   time_t value;
   Bytecount size;
@@ -1065,7 +1067,7 @@
       Extbyte *buf = alloca_extbytes (size);
       Extbyte *formext;
       /* make a copy of the static buffer returned by localtime() */
-      struct tm tm = *localtime (&value); 
+      struct tm tm = NILP (universal) ? *localtime (&value) : *gmtime (&value);
       
       *buf = 1;