Exemplo n.º 1
0
def qtime_to_ms(qtime: QTime) -> int:
    """
    exchange milliseconds from QTime type.
    """
    ms = (qtime.hour() * 3600) + (qtime.minute() * 60) + qtime.second()
    ms *= 1000  # msec 用に1000倍する
    ms += qtime.msec()
    return ms
Exemplo n.º 2
0
    def testQTime(self):
        time = datetime.time(11, 14, 0, 1000)
        other = QTime(time)
        self.assertEqual(time.hour, other.hour())
        self.assertEqual(time.minute, other.minute())
        self.assertEqual(time.second, other.second())
        self.assertEqual(time.microsecond/1000, other.msec())

        self.assertEqual(time, other.toPython())
Exemplo n.º 3
0
    def testQTime(self):
        time = datetime.time(11, 14, 0, 1000)
        other = QTime(time)
        self.assertEqual(time.hour, other.hour())
        self.assertEqual(time.minute, other.minute())
        self.assertEqual(time.second, other.second())
        self.assertEqual(time.microsecond/1000, other.msec())

        self.assertEqual(time, other.toPython())
Exemplo n.º 4
0
def QTime2ms(QTime):
    '''
    arg QTime
    return int
    '''
    h = QTime.hour()
    m = QTime.minute()
    s = QTime.second()
    ms = QTime.msec()
    return h * 3600000 + m * 60000 + s * 1000 + ms