toGmst method

double toGmst()

Calculate Greenwich Mean Sidereal Time for the Julian date.

Returns the angle, in radians, measuring eastward from the Vernal Equinox to the prime meridian. This angle is also referred to as "ThetaG" (Theta GMST).

Implementation

double toGmst() {
  // 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

  final ut = (value + 0.5) % 1.0;
  final tu = (fromJan1_12h_2000() - ut) / 36525.0;

  double gmst = 24110.54841 +
      (tu * (8640184.812866 + (tu * (0.093104 - (tu * 6.2e-06)))));

  gmst = (gmst + (_secondsPerDay * _omegaE * ut)) % _secondsPerDay;

  if (gmst < 0.0) {
    gmst += _secondsPerDay; // "wrap" negative modulo value
  }

  return _twopi * (gmst / _secondsPerDay);
}