diff options
author | Logan Hunt <loganhunt@simponic.xyz> | 2022-05-31 14:56:24 -0700 |
---|---|---|
committer | Logan Hunt <loganhunt@simponic.xyz> | 2022-05-31 14:56:24 -0700 |
commit | 84e566e92bd7c00fa01bd08c5d22ed77cbeb1a4c (patch) | |
tree | d18000ede4f60743786e0d83cd36a83fea24e88e /database/run.lisp | |
parent | e6fe31daef40bec71e962c502f3a17ff9fa59d31 (diff) | |
download | lispruns-84e566e92bd7c00fa01bd08c5d22ed77cbeb1a4c.tar.gz lispruns-84e566e92bd7c00fa01bd08c5d22ed77cbeb1a4c.zip |
Add elapsed time to each split
Diffstat (limited to 'database/run.lisp')
-rw-r--r-- | database/run.lisp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/database/run.lisp b/database/run.lisp index 21d278a..a72f52e 100644 --- a/database/run.lisp +++ b/database/run.lisp @@ -16,6 +16,20 @@ (sxql:order-by :category_split_id) (sxql:where (:= :run run)))) +;; Returns the elapsed time in milliseconds since split started to either +;; current time or the split's end time +(defun run-split-elapsed-time (run-split) + (let ((start (ignore-errors (run-split-start-time run-split))) + (end (or (ignore-errors (run-split-end-time run-split)) (local-time:now)))) + (if start + (floor (* 1000 (local-time:timestamp-difference end start)))))) + +(defun format-elapsed-time (run-split) + (let ((elapsed (run-split-elapsed-time run-split))) + (if elapsed + (format-time (make-time-alist elapsed)) + "-"))) + ;; Returns stuff like PB, best of each split, etc. (defun run-statistics (category) `((asdf . 1))) |