A solar day is the duration of one apparent rotation of the Sun around the Earth. An average solar day is exactly 24 hours; it is an average because the Earth's orbit around the Sun is not a perfect circle. If you watch the night sky at the same time each night, you would notice that the stars in view gradually shift to the West. This happens because the Earth rotates more than 360 degrees (one full rotation) in a solar day. In fact, the Earth rotates 360.986 degrees in 24 hours.
Sidereal time is time kept with respect to the distant stars. Because the stars are so distant, the motion of the Earth in its orbit makes almost no difference in the direction to the stars. (Relatively nearby stars change position with respect to distant stars; this effect can be neglected here.) A sidereal day is the time it takes the Earth to rotate 360 degrees. The duration of a sidereal day is about 23 hours, 56 minutes, and 4 seconds.
LMST = GMST + longitude
Zeno 1.2 is an interpreter for the Zeno programming language. It is an easy to learn and is suitable for educational purposes.
program
% Boston, MA US 42°21' N 71°04' W (-71.07)
while true
put_datetime( true, -71.07 )
synchronize
end while
end program
%
% display univeral time or mean sidereal time using system clock
% Use long := 0 to get the Greenwich MST.
% East longitudes are positive
% West longitudes are negative
% star = false for universal time, true for sidereal time
%
procedure put_datetime( star : boolean, long : real )
% backspace over previous output
put "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"...
% get UTC from MS Windows operating system
var yy, mm, dd, h, m, s : int
var tm : real := systemtime
yy := dateyear( tm )
mm := datemonth( tm )
dd := dateday( tm )
h := timehour( tm )
m := timeminute( tm )
s := timesecond( tm )
if not star then
put d2(mm), '/', d2(dd), '/', yy, " "...
put d2(h), ':', d2(m), ':', d2(s)...
return
end if
% compute MST and RA
var mst, ras : real
mst := mean_sidereal_time( tm, long ) % in degrees
ras := mst % right ascension
mst := mst / 15.0 % time units
% right ascension of vernal equinox
var deg, min, sec : int
deg := floor( ras )
ras := ras - deg
ras := ras * 60
min := floor( ras )
ras := ras - min
ras := ras * 60
sec := floor( ras )
% sidereal time
var hour, minute, second : int
hour := floor( mst )
mst := mst - hour
mst := mst * 60
minute := floor( mst )
mst := mst - minute
mst := mst * 60
second := floor( mst )
% output right ascension and sidereal time
put deg:3, '°', d2(min), '\'', d2(sec), "\" "...
put d2(hour), 'h', d2(minute), 'm', d2(second), 's'...
end procedure
%
% "mean_sidereal_time" returns the Mean Sidereal Time in units of degrees.
% Use lon := 0 to get the Greenwich MST.
% East longitudes are positive
% West longitudes are negative
%
% returns: time in degrees
%
function mean_sidereal_time( now, lon : real ) : real
var year : int := dateyear( now )
var month : int := datemonth( now )
var day : int := dateday( now )
var hour : int := timehour( now )
var minute : int := timeminute( now )
var second : int := timesecond( now )
if (month = 1) or (month = 2) then
year := year - 1
month := month + 12
end if
var a, b, c, d : int
a := floor( year/100 )
b := 2 - a + floor( a/4 )
c := floor( 365.25*year )
d := floor( 30.6001*( month + 1 ) )
var jd, jt, mst : real
% days since J2000.0
jd := b + c + d - 730550.5 + day
+ (hour + minute/60.0 + second/3600.0)/24.0
% julian centuries since J2000.0
jt := jd/36525.0
% mean sidereal time
mst := 280.46061837 + 360.98564736629*jd
+ 0.000387933*jt*jt - jt*jt*jt/38710000 + lon
if (mst > 0.0) then
while (mst > 360.0)
mst := mst - 360.0
end while
else
while (mst < 0.0)
mst := mst + 360.0
end while
end if
return mst
end function
% synchronize to one second intervals
procedure synchronize
var now : real
repeat
now := timemsecs( systemtime )
until now < 50
end procedure
% format two digits with leading zero if needed
function d2( n : int ) : string
assert (0 <= n) and (n < 100)
if n < 10 then
return "0" & intstr( n, 1 )
else
return intstr( n, 2 )
end if
end function
310°53'26" 20h43m33s
AbCd Classics - free on-line books