Aidan Kehoe avatar Aidan Kehoe committed aa5f38e

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!

Comments (0)

Files changed (2)

+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:
 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.
 
 The number of options reflects the `strftime' function.
 */
-       (format_string, time_))
+       (format_string, time_, universal))
 {
   time_t value;
   Bytecount size;
       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;
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.