There is formula for stars sideral time: $$ra - \arccos(-\tan(dec)*\tan(lat)).$$

where $ra$ - is right of ascension at the vernal equinox.

$lat$ = latitude

$dec$ = declination

Is it applicable for the sun with 0 $ra$ and 0 $decl$? If not, why not?

I want to use Need Simple equation for Rise, Transit, and Set time to get setting time and rising time of a star to code.

for(int m=1;m<100;m++){
ts =2*M_PI*m+ (ra - acos(-tan(dec)*tan(lat))); // angle on each day iterating m
d=(ts-4.894961212735792 - longitude)/(6.30038809898489);
printf("%f since midnight", (d-0.5)/24); // d - 0.5 to handle midnight
  1. I am not sure if my iteration is ok
  2. d - 0.5

1 Answer 1


Firstly, there is no star's sidereal time.
Sidereal time is dependent on the current date and time. It equals the star's right ascension plus its hour angle ... which is almost the formula you provided, since the hour angle is $acos(-tg({\delta})tg({\phi}))$ only when the star's altitude is zero (also, the minus should be a plus).
Considering the right ascension added to the hour angle is constant for all points on the celestial sphere (since they are measured in the opposite direction, this sum will be the hour angle of the ${\gamma}$point), this formula is valid for all points, including the Sun.

  • $\begingroup$ The code part was not there when I answered this ... $\endgroup$
    – Tosic
    Commented Oct 12, 2019 at 19:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .