diff options
| author | Logan Hunt <loganhunt@simponic.xyz> | 2022-05-31 15:59:29 -0700 |
|---|---|---|
| committer | Logan Hunt <loganhunt@simponic.xyz> | 2022-05-31 15:59:29 -0700 |
| commit | 10d7a20a79f8e7746d965cfadf1757b3e3799858 (patch) | |
| tree | d0a3e66456f28858701e2ca2507ba452de3185f9 /time.lisp | |
| parent | 84e566e92bd7c00fa01bd08c5d22ed77cbeb1a4c (diff) | |
| download | speedrun-timer-10d7a20a79f8e7746d965cfadf1757b3e3799858.tar.gz speedrun-timer-10d7a20a79f8e7746d965cfadf1757b3e3799858.zip | |
Change to centiseconds across the program
Diffstat (limited to 'time.lisp')
| -rw-r--r-- | time.lisp | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1,9 +1,9 @@ -;; Makes a-list with '((hours . HOURS) (minutes . MINUTES) (seconds . SECONDS) (ms . MILLISECONDS)) -(defun make-time-alist (ms) - `((hours . ,(floor (/ ms (* 1000 60 60)))) - (minutes . ,(floor (mod (/ ms (* 1000 60)) 60))) - (seconds . ,(floor (mod (/ ms 1000) 60))) - (ms . ,(mod ms 1000)))) +;; Makes a-list with '((hours . HOURS) (minutes . MINUTES) (seconds . SECONDS) (cs . CENTISECONDS)) +(defun make-time-alist (cs) + `((hours . ,(floor (/ cs (* 100 60 60)))) + (minutes . ,(floor (mod (/ cs (* 100 60)) 60))) + (seconds . ,(floor (mod (/ cs 100) 60))) + (cs . ,(mod cs 100)))) ;; Formats, disregarding min/hour if they shouldn't be shown, a time alist to "H:M:S.ms" (defun format-time (time-alist) @@ -11,7 +11,7 @@ ((hours (cdr (assoc 'hours time-alist))) (minutes (cdr (assoc 'minutes time-alist))) (seconds (cdr (assoc 'seconds time-alist))) - (centis (round (/ (cdr (assoc 'ms time-alist)) 10)))) + (centis (cdr (assoc 'cs time-alist)))) (concatenate 'string (unless (zerop hours) (format nil "~2,'0d:" hours)) (unless (and (zerop minutes) (zerop hours)) (format nil "~2,'0d:" minutes)) |
