summaryrefslogtreecommitdiff
path: root/speedrun.lisp
diff options
context:
space:
mode:
authorLogan Hunt <loganhunt@simponic.xyz>2022-05-31 15:59:29 -0700
committerLogan Hunt <loganhunt@simponic.xyz>2022-05-31 15:59:29 -0700
commit10d7a20a79f8e7746d965cfadf1757b3e3799858 (patch)
treed0a3e66456f28858701e2ca2507ba452de3185f9 /speedrun.lisp
parent84e566e92bd7c00fa01bd08c5d22ed77cbeb1a4c (diff)
downloadlispruns-10d7a20a79f8e7746d965cfadf1757b3e3799858.tar.gz
lispruns-10d7a20a79f8e7746d965cfadf1757b3e3799858.zip
Change to centiseconds across the program
Diffstat (limited to 'speedrun.lisp')
-rw-r--r--speedrun.lisp6
1 files changed, 4 insertions, 2 deletions
diff --git a/speedrun.lisp b/speedrun.lisp
index df473c9..ba2d199 100644
--- a/speedrun.lisp
+++ b/speedrun.lisp
@@ -44,7 +44,7 @@
;; Updates the current total elapsed time of the speedrun if it's running
(defun update-time (speedrun)
(if (eq (speedrun-state speedrun) 'RUNNING)
- (setf (speedrun-elapsed speedrun) (* 1000 (/ (- (get-internal-real-time) (speedrun-start-timestamp speedrun)) internal-time-units-per-second)))))
+ (setf (speedrun-elapsed speedrun) (floor (* 100 (/ (- (get-internal-real-time) (speedrun-start-timestamp speedrun)) internal-time-units-per-second))))))
;; Initializes a speedrun to start running the timer
(defun start-speedrun (speedrun)
@@ -64,7 +64,9 @@
(setf (run-split-end-time (current-split speedrun)) now)
(if (equal (speedrun-current-split-index speedrun) (1- (length (speedrun-splits speedrun))))
(progn
- (setf (speedrun-state speedrun) 'STOPPED)
+ (setf
+ (speedrun-elapsed speedrun) (apply '+ (mapcar 'run-split-elapsed-time (speedrun-splits speedrun)))
+ (speedrun-state speedrun) 'STOPPED)
(save-speedrun speedrun))
(progn
(inc (speedrun-current-split-index speedrun))