did some work on logic
This commit is contained in:
parent
28efaf51bf
commit
c009e662bd
23
logic.lisp
23
logic.lisp
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue