[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 397fdc22eb: * lisp/calendar/time-date.el (seconds-to-time): Use t

From: Stefan Monnier
Subject: master 397fdc22eb: * lisp/calendar/time-date.el (seconds-to-time): Use the original arg list
Date: Sun, 14 Aug 2022 10:41:49 -0400 (EDT)

branch: master
commit 397fdc22eb140dd80e878528fd65e74da4033fa8
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * lisp/calendar/time-date.el (seconds-to-time): Use the original arg list
 lisp/calendar/time-date.el | 12 ++++++------
 src/timefns.c              | 13 ++++++++++---
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index 7e911d814d..bbdcaa4db4 100644
--- a/lisp/calendar/time-date.el
+++ b/lisp/calendar/time-date.el
@@ -171,13 +171,13 @@ If DATE lacks timezone information, GMT is assumed."
              (error "Invalid date: %s" date)))))))))
-(defalias 'time-to-seconds 'float-time)
+(defalias 'time-to-seconds #'float-time)
-(defun seconds-to-time (seconds &rest form)
-  "Convert SECONDS to a proper time, like `current-time' would.
-FORM means the same as in `time-convert'."
-  (time-convert seconds form))
+(defun seconds-to-time (seconds)
+  "Convert SECONDS to a proper time, like `current-time' would."
+  ;; FIXME: Should we (declare (obsolete time-convert "27.1")) ?
+  (time-convert seconds 'list))
 (defun days-to-time (days)
@@ -202,7 +202,7 @@ TIME should be either a time value or a date-time string."
   (time-subtract nil time))
-(define-obsolete-function-alias 'subtract-time 'time-subtract "26.1")
+(define-obsolete-function-alias 'subtract-time #'time-subtract "26.1")
 (defun date-to-day (date)
diff --git a/src/timefns.c b/src/timefns.c
index 7db50ea81c..edfd73e9b8 100644
--- a/src/timefns.c
+++ b/src/timefns.c
@@ -401,6 +401,10 @@ decode_float_time (double t, struct lisp_time *result)
       int scale = double_integer_scale (t);
+      /* FIXME: `double_integer_scale` often returns values that are
+         "pessimistic" (i.e. larger than necessary), so 3.5 gets converted
+         to (7881299347898368 . 2251799813685248) rather than (7 . 2).
+         On 64bit systems, this should not matter very much, tho.  */
       eassume (scale < flt_radix_power_size);
       if (scale < 0)
@@ -1717,8 +1721,6 @@ DEFUN ("time-convert", Ftime_convert, Stime_convert, 1, 
2, 0,
        doc: /* Convert TIME value to a Lisp timestamp of the given FORM.
 Truncate the returned value toward minus infinity.
-If FORM is nil, return the same form as `current-time'.
 If FORM is a positive integer, return a pair of integers (TICKS . FORM),
 where TICKS is the number of clock ticks and FORM is the clock frequency
 in ticks per second.
@@ -1731,9 +1733,14 @@ If FORM is `integer', return an integer count of seconds.
 If FORM is `list', return an integer list (HIGH LOW USEC PSEC), where
 HIGH has the most significant bits of the seconds, LOW has the least
 significant 16 bits, and USEC and PSEC are the microsecond and
-picosecond counts.  */)
+picosecond counts.
+If FORM is nil, the behavior depends on `current-time-list',
+but new code should not rely on it.  */)
      (Lisp_Object time, Lisp_Object form)
+  /* FIXME: Any reason why we don't offer a `float` output format option as
+     well, since we accept it as input?  */
   struct lisp_time t;
   enum timeform input_form = decode_lisp_time (time, false, &t, 0);
   if (NILP (form))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]