toGmst method

double toGmst()

toGmst() Calculate Greenwich Mean Sidereal Time for the Julian date. The return value is the angle, in radians, measuring eastward from the Vernal Equinox to the prime meridian. This angle is also referred to as "ThetaG" (Theta GMST).

References: The 1992 Astronomical Almanac, page B6. Explanatory Supplement to the Astronomical Almanac, page 50. Orbital Coordinate Systems, Part III, Dr. T.S. Kelso, Satellite Times, Nov/Dec 1995

Implementation

double toGmst() {
  final double UT = (_date + 0.5).remainder(1.0);
  final double TU = (fromJan1_12h_2000() - UT) / 36525.0;

  double GMST =
      24110.54841 + TU * (8640184.812866 + TU * (0.093104 - TU * 6.2e-06));

  GMST = (GMST + SEC_PER_DAY * OMEGA_E * UT).remainder(SEC_PER_DAY);

  if (GMST < 0.0) GMST += SEC_PER_DAY; // "wrap" negative modulo value

  return (TWOPI * (GMST / SEC_PER_DAY));
}