emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/chess e30ddb4: Simplify/port chess clock timer


From: Paul Eggert
Subject: [elpa] externals/chess e30ddb4: Simplify/port chess clock timer
Date: Sat, 11 Dec 2021 22:05:56 -0500 (EST)

branch: externals/chess
commit e30ddb4e9eda043d0ea357a52017f20e71ec05cf
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    Simplify/port chess clock timer
    
    * packages/chess/chess-clock.el (chess-clock-add-seconds)
    (chess-clock-time-to-seconds): Simplify and port to future
    Emacs versions planned to use different time stamp formats.
---
 chess-clock.el | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/chess-clock.el b/chess-clock.el
index 2fe7167..c08b4b2 100644
--- a/chess-clock.el
+++ b/chess-clock.el
@@ -32,19 +32,11 @@
 
 (defsubst chess-clock-add-seconds (time seconds)
   "To TIME, add SECONDS.  Return result as a time value."
-  (let* ((secint (truncate seconds))
-        (hi (/ secint 65536))
-        (lo (% secint 65536))
-        (calc (+ (cadr time) lo)))
-    (if (< calc 65536)
-       (list (+ (car time) hi) calc)
-      (list (+ (car time) (1+ hi)) (% calc 65536)))))
+  (time-add time seconds))
 
 (defsubst chess-clock-time-to-seconds (time)
   "Convert TIME to a floating point number."
-  (+ (* (car time) 65536.0)
-     (cadr time)
-     (/ (or (car (cdr (cdr time))) 0) 1000000.0)))
+  (float-time time))
 
 (defsubst chess-clock-time-diff (t1 t2)
   "Return the difference in seconds between T1 and T2."



reply via email to

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