def testDynamicalFromUniversal(self): date = GregorianDate(1977, MonthOfYear.FEBRUARY, 18) time = Clock(3, 36, 52).to_time() utc = date.toordinal() + time td = dynamical_from_universal(utc) clk = Clock.from_moment(td) self.assertEqual(clk.hour, 3) self.assertEqual(clk.minute, 37) self.assertEqual(int(round(clk.second)), 40) date = GregorianDate(333, MonthOfYear.FEBRUARY, 6) time = Clock(6, 0, 0).to_time() utc = date.toordinal() + time td = dynamical_from_universal(utc) clk = Clock.from_moment(td) self.assertEqual(clk.hour, 7) self.assertEqual(clk.minute, 57) self.assertAlmostEqual(clk.second, 54.66054, 4)
def testUniversalFromDynamical(self): date = GregorianDate(1977, MonthOfYear.FEBRUARY, 18) time = Clock(3, 37, 40).to_time() td = date.toordinal() + time utc = universal_from_dynamical(td) clk = Clock.from_moment(utc) self.assertEqual(clk.hour, 3) self.assertEqual(clk.minute, 36) self.assertEqual(int(round(clk.second)), 52)