did some work on logic

This commit is contained in:
a. fox 2023-07-31 15:14:50 -04:00
parent 28efaf51bf
commit c009e662bd
1 changed files with 15 additions and 8 deletions

View File

@ -116,21 +116,28 @@ if DIRECTORY is non-nil we wipe out *LOAD-DIR* and set it to DIRECTORY"
(defun create-timestring (from-system to-system seconds)
(apply #'format
`(nil "y~A:d~A:~A:~A:~A"
`(nil "y~A:d~A:~A:~A:~A" ;; ,(if (get-model-value "usesCycles" to-system) ;;
;; "c~A:y~A:d~A:~A:~A:~A" ;;
;; "y~A:d~A:~A:~A:~A") ;;
,@(apply #'funky
`(,seconds
`(,(to-target seconds from-system to-system)
,@(loop :for key :in '("secondsInYear" "daysInYear" "hoursInDay"
"minutesInHour" "secondsInMinute")
:collect (get-model-value key to-system)))))))
(defun to-gts (local-secs from-system to-system)
"Converts the local seconds to GTS seconds"
(flet ((uses-galactic-second-p (system)
(labels ((uses-galactic-second-p (system)
(get-model-value "usesGalacticSecond" system))
(needs-conversion-p (from to)
(not (and (get-model-value "usesGalacticSecond" to)
(get-model-value "usesGalacticSecond" from)))))
(not (and (uses-galactic-second-p to)
(uses-galactic-second-p from)))))
(defun to-target (gts-secs from-system to-system)
(let ((secs gts-secs))
(+ (- secs (gethash-nested to-system "yearZero" "galactic"))
(gethash-nested to-system "yearZero" "local"))))
(defun to-gts (local-secs from-system to-system)
"Converts the local seconds to GTS seconds"
(let ((secs (if (needs-conversion-p from-system to-system)
(if (uses-galactic-second-p from-system)
(/ local-secs 1.4)