| home | send comment | send link | add bookmark |

Calculating Sidereal Time

by Stephen R. Schmitt

Introduction

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.

Celestial coordinates

Maps of the celestial sphere, stars and other deep space objects, use declination and right ascension to specify position. Declination and right ascension have the same role as latitude and longitude. Declination is measured north or south from the celestial equator and is expressed in degrees. Right ascension is measured eastward from the the vernal equinox and is expressed in hours, minutes, and seconds. The angle between an observer's meridian and the right ascension of some celestial body is called the hour angle.

Vernal equinox

An equinox is the moment when the Sun crosses the celestial equator marking the beginning of the seasons of spring and autumn. The vernal equinox occurs in March; the autumnal equinox in September. The start of the other seasons is marked by solstices. The location of the Sun in the sky when it crosses the celestial equator is also called an equinox. In the celestial equatorial coordinate system, the vernal equinox has right ascension and declination equal to zero.

Sidereal time

Sidereal time is the measure of the hour angle of the vernal equinox. At a given sidereal time, the stars appear in the same places in the sky as seen from a fixed point on the Earth's surface. If the mean vernal equinox is used as the origin of the celestial coordinate system, the mean sidereal time is given. When the time is given with respect to the meridian at Greenwich (0° longitude), it is Greenwich mean sidereal time (GMST). The local sidereal time is equal to the right ascension that passes through the local celestial meridian (a line in the sky from pole to pole that passes overhead) at that moment. To get the local mean sidereal time at your longitude, just add your longitude, taking East as positive:
    LMST = GMST + longitude

 

Zeno source code

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

Sample output

310°53'26" 20h43m33s

References

  1. Astronomical Algorithms, Meeus
  2. USNO Astronomical Applications Department

May be of interest


AbCd Classics - free on-line books


Copyright © 2005, Stephen R. Schmitt