aboutsummaryrefslogtreecommitdiffstats
path: root/src/editfns.c
diff options
context:
space:
mode:
authorDmitry Antipov2015-01-14 13:05:17 +0300
committerDmitry Antipov2015-01-14 13:05:17 +0300
commit99a1492b8a1269a9a5a280c0510d0ec00114a9a1 (patch)
tree1dea93cd3476c72e7a7d904a6b3c21772951c2ad /src/editfns.c
parentda396beb6e0b9ef9a45afb849eeda26da14038af (diff)
downloademacs-99a1492b8a1269a9a5a280c0510d0ec00114a9a1.tar.gz
emacs-99a1492b8a1269a9a5a280c0510d0ec00114a9a1.zip
Fix last time zone handling change.
* editfns.c (decode_time_zone): Return Lisp string instead. All related users changed.
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/editfns.c b/src/editfns.c
index e097893a6f9..9a159ba6581 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2065,15 +2065,13 @@ check_tm_member (Lisp_Object obj, int offset)
2065 2065
2066/* Decode ZONE as a time zone specification. */ 2066/* Decode ZONE as a time zone specification. */
2067 2067
2068static const char * 2068static Lisp_Object
2069decode_time_zone (Lisp_Object zone) 2069decode_time_zone (Lisp_Object zone)
2070{ 2070{
2071 const char *tzstring = NULL;
2072
2073 if (EQ (zone, Qt)) 2071 if (EQ (zone, Qt))
2074 tzstring = "UTC0"; 2072 return build_string ("UTC0");
2075 else if (STRINGP (zone)) 2073 else if (STRINGP (zone))
2076 tzstring = SSDATA (zone); 2074 return zone;
2077 else if (INTEGERP (zone)) 2075 else if (INTEGERP (zone))
2078 { 2076 {
2079 static char const tzbuf_format[] = "XXX%s%"pI"d:%02d:%02d"; 2077 static char const tzbuf_format[] = "XXX%s%"pI"d:%02d:%02d";
@@ -2081,13 +2079,11 @@ decode_time_zone (Lisp_Object zone)
2081 EMACS_INT abszone = eabs (XINT (zone)), zone_hr = abszone / (60 * 60); 2079 EMACS_INT abszone = eabs (XINT (zone)), zone_hr = abszone / (60 * 60);
2082 int zone_min = (abszone / 60) % 60, zone_sec = abszone % 60; 2080 int zone_min = (abszone / 60) % 60, zone_sec = abszone % 60;
2083 2081
2084 sprintf (tzbuf, tzbuf_format, &"-"[XINT (zone) < 0], 2082 return make_formatted_string (tzbuf, tzbuf_format, &"-"[XINT (zone) < 0],
2085 zone_hr, zone_min, zone_sec); 2083 zone_hr, zone_min, zone_sec);
2086 tzstring = tzbuf;
2087 } 2084 }
2088 else 2085 else
2089 xsignal2 (Qerror, build_string ("Invalid time zone specification"), zone); 2086 xsignal2 (Qerror, build_string ("Invalid time zone specification"), zone);
2090 return tzstring;
2091} 2087}
2092 2088
2093DEFUN ("encode-time", Fencode_time, Sencode_time, 6, MANY, 0, 2089DEFUN ("encode-time", Fencode_time, Sencode_time, 6, MANY, 0,
@@ -2132,7 +2128,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
2132 value = mktime (&tm); 2128 value = mktime (&tm);
2133 else 2129 else
2134 { 2130 {
2135 timezone_t tz = tzalloc (decode_time_zone (zone)); 2131 timezone_t tz = tzalloc (SSDATA (decode_time_zone (zone)));
2136 value = mktime_z (tz, &tm); 2132 value = mktime_z (tz, &tm);
2137 tzfree (tz); 2133 tzfree (tz);
2138 } 2134 }
@@ -2278,7 +2274,7 @@ variable `process-environment', whereas `set-time-zone-rule' affects
2278only the former. */) 2274only the former. */)
2279 (Lisp_Object tz) 2275 (Lisp_Object tz)
2280{ 2276{
2281 const char *tzstring = NILP (tz) ? initial_tz : decode_time_zone (tz); 2277 const char *tzstring = NILP (tz) ? initial_tz : SSDATA (decode_time_zone (tz));
2282 2278
2283 block_input (); 2279 block_input ();
2284 set_time_zone_rule (tzstring); 2280 set_time_zone_rule (tzstring);