💾 Archived View for librehacker.com › gemlog › starlog › 20240115-0.gmi captured on 2024-05-26 at 15:04:25. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-05-10)
-=-=-=-=-=-=-
Something I have wanted to have for a while is a handy sidereal time clock, set to my Local Sidereal Time. For those not familiar with it, the basic idea is that, due to our orbit around the sun, the sun moves around the sky at a slightly slower speed than the stars. This is a fun, but sometimes confusing, feature of our created universe which allows most of us to see a slightly different set of stars each night throughout the different seasons of the year — the exception being those who live on either the north or the south pole.
Consequently, time defined by the movement of the sun around the sky is slightly different than time defined by the rotation of the earth around its axis. A sidereal second is equal to 0.99726956 conventional seconds. Or to put it another way, a normal day consists of 86400 normal seconds, but it takes 86164.09 sidereal seconds to make a normal day.
Since any given sidereal time corresponds (within a practical level of approximation) to a fixed line across the sky (i.e., the celestial sphere) then you can have a rough idea of where all the stars are right now, if you know your Local Sidereal Time. So, I've been trying to figure out how I could keep track of my LST, ideally without having to use any Web app or any proprietary software. I don't carry a smart phone, so Android apps are not an option either.
I can see the sidereal time using Stellarium, but I have to turn the program on, select a star, and then look through the star's onscreen information display to find the sidereal time, even though it is the same regardless of which star I select. That requires a lot of CPU to keep running and is not convenient. I looked around for other free software solutions in the Guix repository, but couldn't find what I was looking for. Actually, there are some good python modules, but I wanted to use Lisp if at all possible.
I found this formula on stack exchange, and decided to try to implement it in Common Lisp:
I used sbcl-local-time to help with the time calculations. Something I was confused about from the beginning, and still am, is how to define the j2000 epoch. I started with this:
(defparameter j2000-ts (lt:encode-timestamp 816000000 56 58 11 1 1 2000 :timezone lt:+utc-zone+))
And here is the the core function:
;; Answer is in degrees (defun lst (ts long) (let* ((sec-from-j2000-ts (- (lt:timestamp-to-unix ts) (lt:timestamp-to-unix j2000-ts))) (d (/ sec-from-j2000-ts (* 60 60 24.0))) (ut (/ (lt:sec-of ts) 3600))) (mod (+ 100.46 (* 0.985647 d) long (* 15 ut)) 360.0))) (defun current-lst (long) (lst (lt:now) long))
Those fond of simplification might be annoyed by the extra math steps, but the compiler will take care of that. I do, however, need to convert from the rotation angle to the 24 hour time representation:
(defun deg-to-time-values (d) (let* ((raw-hours (* (/ d 360.0) 24)) (whole-hours (floor raw-hours)) (raw-minutes (* (- raw-hours whole-hours) 60)) (whole-minutes (floor raw-minutes)) (raw-seconds (* (- raw-minutes whole-minutes) 60))) (values whole-hours whole-minutes (floor raw-seconds))))
And this allows me to print it out:
(defun print-current-lst (long) (multiple-value-bind (h m s) (deg-to-time-values (current-lst long)) (map nil (lambda (obj) (princ obj)) (format *standard-output* "~2,'0d:~2,'0d:~2,'0d" h m s))))
Comparing this to the values (mean and apparent) in Stellarium, or to the output from https://aa.usno.navy.mil/data/siderealtime, it is not right on, but I seem to be always within one minute of those values, which is close enough for my purposes. I was curious what would happen if I changed the j2000 parameter to this:
(defparameter j2000-ts (lt:encode-timestamp 0 0 0 12 1 1 2000 :timezone lt:+utc-zone+))
But strangely enough, it didn't change the output of the program. (???)
I wrote a little more code to keep my LST displayed in one terminal, and on another monitor I have the SFA star charts displayed, and now it easy for me to visualize where the stars are throughout the day, without having to cheat and look at Stellarium.
Something I would like to do in the future is build a clock that displays sidereal time, using a servo and a microchip. I have the servo and the microchip already, but I'm not sure how soon I will get around to that project.
This work © 2024 by Christopher Howard is licensed under Attribution-ShareAlike 4.0 International.