/** * @covers Marando\AstroDate\AstroDate::toTDB */ public function testToTDB() { $tt = AstroDate::jd(2453750.5 + 0.892855139, TimeScale::TT()); $tdb = AstroDate::jd(2453750.5 + 0.8928551366736112, TimeScale::TDB()); $this->assertEquals($tdb->toJD(), $tt->toTDB()->toJD(), 'TT -> TDB', 1.0E-8); }
/** * Converts this instance to Barycentric Dynamic Time (TDB) * @return static */ public function toTDB() { if ($this->timescale == TimeScale::TDB()) { return $this; } $this->toTT(); $tt1 = $this->jd; $tt2 = $this->dayFrac; $this->toUT1(); $ut = $this->dayFrac; $dtr = IAU::Dtdb($tt1, $tt2, $ut, 0, 0, 0); IAU::Tttdb($tt1, $tt2, $dtr, $tdb1, $tdb2); $this->jd = $tdb1; $this->dayFrac = $tdb2; $this->timescale = TimeScale::TDB(); return $this; }