>>>> "Simon" == Simon Josefsson
<jas(a)extundo.com> writes:
Simon> Yes. The patch below fixes it, someone at xemacs-patches
Simon> please have a look at it.
Simon> XEmacs 21.1, 21.4 (without patch):
Simon> (encode-time 0 0 1 1 1 1969 nil nil 3600)
Simon> (65054 52352)
wasteful_word_to_lisp() is required to produce this result by the C
standard.
Simon> Emacs 20.7, 21.1 (and XEmacs 21.4 with patch):
Simon> (encode-time 0 0 1 1 1 1969 nil nil 3600)
Simon> (-482 52352)
This result is plausible, but the C standard does not require GNU's
make_time to produce it AFAIK.
For XEmacs 21.4.6, I'm going to (1) use GNU's make_time(), but divide
by 2^16 when time is negative to guarantee the desired result (how
Martinesque), and (2) eliminate use of (wasteful_)?word_to_lisp() to
decode time (only in dired.c).
Comments?
Simon's patch follows in full for those who just joined us. The
semantic difference between Simon's version and the current XEmacs
code can be summarized by "s/time_t/unsigned int/".
2001-11-10 Simon Josefsson <jas(a)extundo.com>
* editfns.c (make_time): New function, from Emacs.
(Fencode_time): Use it, instead of `wasteful_word_to_lisp'.
--- editfns.c.~1.27.2.2.~ Wed Nov 7 20:43:02 2001
+++ editfns.c Sat Nov 10 19:57:27 2001
@@ -1176,6 +1176,14 @@
static void set_time_zone_rule (char *tzstring);
+Lisp_Object
+make_time (time)
+ time_t time;
+{
+ return Fcons (make_int (time >> 16),
+ Fcons (make_int (time & 0177777), Qnil));
+}
+
DEFUN ("encode-time", Fencode_time, 6, MANY, 0, /*
Convert SECOND, MINUTE, HOUR, DAY, MONTH, YEAR and ZONE to internal time.
This is the reverse operation of `decode-time', which see.
@@ -1249,7 +1257,7 @@
if (the_time == (time_t) -1)
error ("Specified time is not representable");
- return wasteful_word_to_lisp (the_time);
+ return make_time (the_time);
}
DEFUN ("current-time-string", Fcurrent_time_string, 0, 1, 0, /*
--
Institute of Policy and Planning Sciences
http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Don't ask how you can "do" free software business;
ask what your business can "do for" free software.