Commit 99a1492b authored by Dmitry Antipov's avatar Dmitry Antipov
Browse files

Fix last time zone handling change.

* editfns.c (decode_time_zone): Return Lisp string instead.
All related users changed.
parent da396beb
......@@ -2065,15 +2065,13 @@ check_tm_member (Lisp_Object obj, int offset)
/* Decode ZONE as a time zone specification. */
static const char *
static Lisp_Object
decode_time_zone (Lisp_Object zone)
{
const char *tzstring = NULL;
if (EQ (zone, Qt))
tzstring = "UTC0";
return build_string ("UTC0");
else if (STRINGP (zone))
tzstring = SSDATA (zone);
return zone;
else if (INTEGERP (zone))
{
static char const tzbuf_format[] = "XXX%s%"pI"d:%02d:%02d";
......@@ -2081,13 +2079,11 @@ decode_time_zone (Lisp_Object zone)
EMACS_INT abszone = eabs (XINT (zone)), zone_hr = abszone / (60 * 60);
int zone_min = (abszone / 60) % 60, zone_sec = abszone % 60;
sprintf (tzbuf, tzbuf_format, &"-"[XINT (zone) < 0],
zone_hr, zone_min, zone_sec);
tzstring = tzbuf;
return make_formatted_string (tzbuf, tzbuf_format, &"-"[XINT (zone) < 0],
zone_hr, zone_min, zone_sec);
}
else
xsignal2 (Qerror, build_string ("Invalid time zone specification"), zone);
return tzstring;
}
DEFUN ("encode-time", Fencode_time, Sencode_time, 6, MANY, 0,
......@@ -2132,7 +2128,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
value = mktime (&tm);
else
{
timezone_t tz = tzalloc (decode_time_zone (zone));
timezone_t tz = tzalloc (SSDATA (decode_time_zone (zone)));
value = mktime_z (tz, &tm);
tzfree (tz);
}
......@@ -2278,7 +2274,7 @@ variable `process-environment', whereas `set-time-zone-rule' affects
only the former. */)
(Lisp_Object tz)
{
const char *tzstring = NILP (tz) ? initial_tz : decode_time_zone (tz);
const char *tzstring = NILP (tz) ? initial_tz : SSDATA (decode_time_zone (tz));
block_input ();
set_time_zone_rule (tzstring);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment