def testMJD(self): ts = DateTime(45205.125, DateTime.MJD, DateTime.UTC) self.assertEqual(ts.nsecs(DateTime.UTC), 399006000000000000L) self.assertEqual(ts.nsecs(DateTime.TAI), 399006021000000000L) self.assertAlmostEqual(ts.get(DateTime.MJD, DateTime.UTC), 45205.125) self.assertAlmostEqual(ts.get(DateTime.MJD, DateTime.TAI), 45205.125 + 21.0/86400.0) # Following interface is deprecated self.assertAlmostEqual(ts.mjd(DateTime.UTC), 45205.125) self.assertAlmostEqual(ts.mjd(DateTime.TAI), 45205.125 + 21.0/86400.0)
def testNsecs(self): ts = DateTime(1192755473000000000L, DateTime.UTC) self.assertEqual(ts.nsecs(DateTime.UTC), 1192755473000000000L) self.assertEqual(ts.nsecs(DateTime.TAI), 1192755506000000000L) self.assertEqual(ts.nsecs(), 1192755506000000000L) self.assertAlmostEqual(ts.get(DateTime.MJD, DateTime.UTC), 54392.040196759262) ts2 = ts self.assertEqual(ts, ts2) ts2 = DateTime(1192755473000000000L, DateTime.UTC) self.assertEqual(ts, ts2) ts2 = DateTime(1234567890000000000L, DateTime.UTC) self.assertNotEqual(ts, ts2)
def testNsecsDefault(self): ts = DateTime(1192755506000000000L) self.assertEqual(ts.nsecs(DateTime.UTC), 1192755473000000000L) self.assertEqual(ts.nsecs(DateTime.TAI), 1192755506000000000L) self.assertEqual(ts.nsecs(), 1192755506000000000L) self.assertAlmostEqual(ts.get(DateTime.MJD, DateTime.UTC), 54392.040196759262)
def testBoundaryMJD(self): ts = DateTime(47892.0, DateTime.MJD, DateTime.UTC) self.assertEqual(ts.nsecs(DateTime.UTC), 631152000000000000L) self.assertEqual(ts.nsecs(DateTime.TAI), 631152025000000000L) self.assertEqual(ts.get(DateTime.MJD, DateTime.UTC), 47892.0)