Пример #1
0
 def seconds_and_nanoseconds(dt):
     if isinstance(dt, datetime):
         dt = DateTime.from_native(dt)
     zone_epoch = DateTime(1970, 1, 1, tzinfo=dt.tzinfo)
     dt_clock_time = dt.to_clock_time()
     zone_epoch_clock_time = zone_epoch.to_clock_time()
     t = dt_clock_time - zone_epoch_clock_time
     return t.seconds, t.nanoseconds
Пример #2
0
 def test_conversion_to_t(self):
     dt = DateTime(2018, 4, 26, 23, 0, 17.914390409)
     t = dt.to_clock_time()
     self.assertEqual(t, ClockTime(63660380417, 914390409))