Beispiel #1
0
 /**
  * Calculates the sidereal time for the given timestamp.
  *
  * @return float
  */
 public function getSiderealTime()
 {
     $julianDay = new JulianDay($this->dateTime);
     $T = bcdiv(bcsub(strval($julianDay), '2451545.0'), '36525');
     $T2 = bcpow($T, '2');
     $T3 = bcpow($T, '3');
     $term1 = '280.46061837';
     $term2 = bcmul('360.98564736629', bcsub(strval($julianDay), '2451545.0'));
     $term3 = bcmul('0.000387933', $T2);
     $term4 = bcdiv($T3, '38710000');
     $result = bcsub(bcadd(bcadd($term1, $term2), $term3), $term4);
     while (bccomp($result, 0) == -1) {
         $result = bcadd($result, '360');
     }
     while (bccomp($result, '360') >= 1) {
         $result = bcsub($result, '360');
     }
     $st = new Time();
     $st->setHourAngle(floatval($result));
     return $st->getValue();
 }
Beispiel #2
0
 public function testSetHourAngleWorksAsExpected()
 {
     $time = new Time();
     $time->setHourAngle(100.596390417);
     $this->assertEquals(6.7064260278, $time->getValue());
 }