示例#1
0
    def test_time(self):
        ct = cyber_time.Time(123)
        self.assertEqual(123, ct.to_nsec())
        ftime = ct.now().to_sec()
        print ftime
        time.sleep(1)
        ftime = cyber_time.Time.now().to_sec()
        print ftime
        ftime = cyber_time.Time.mono_time().to_sec()
        print ftime

        td1 = cyber_time.Duration(111)
        tm1 = ct - td1
        self.assertEqual(12, tm1.to_nsec())

        tm5 = cyber_time.Time(1.8)
        self.assertEqual(1800000000, tm5.to_nsec())
        tm7 = cyber_time.Time(tm5)
        self.assertEqual(1800000000, tm7.to_nsec())
示例#2
0
def test_time():
    ct = cyber_time.Time(123)
    print(ct.to_nsec())
    ftime = ct.now().to_sec()
    print(ftime)
    time.sleep(1)
    ftime = cyber_time.Time.now().to_sec()
    print(ftime)
    ftime = cyber_time.Time.mono_time().to_sec()
    print(ftime)

    td1 = cyber_time.Duration(111)
    tm1 = ct - td1
    print("ct sub du is ", tm1)
    tm1 = ct - td1
    print(tm1)

    tm5 = cyber_time.Time(1.8)
    tm7 = cyber_time.Time(tm5)
    print(tm7)