Example #1
0
 /**
  * Finds the sidereal time of this intsance
  *
  * @param type  $mode Type of sidereal time... (a = apparent, m = mean)
  * @param Angle $lon  If a longitude is supplied, finds local sidereal time,
  *                    otherwise returns sidereal time at Greenwich
  */
 public function sidereal($mode = 'a', Angle $lon = null)
 {
     // Get UT1 time
     $ut = $this->copy()->toUT1();
     $uta = $ut->jd;
     $utb = $ut->dayFrac;
     $ut = null;
     // Get TT time
     $tt = $this->copy()->toTT();
     $tta = $tt->jd;
     $ttb = $tt->dayFrac;
     $tt = null;
     // Compute either GMST or GAST
     $st;
     if ($mode == 'a') {
         $strad = IAU::Gst06a($uta, $utb, $tta, $ttb);
     } else {
         $strad = IAU::Gmst06($uta, $utb, $tta, $ttb);
     }
     // Add longitude if relevant
     if ($lon) {
         $st = Angle::rad($strad)->add($lon)->norm()->toTime();
     } else {
         $st = Angle::rad($strad)->toTime();
     }
     // Return as hours
     return $st->setUnit('hours');
 }