21 TIMEVALUE_ONE_SECOND_IN_USECS = 1000000
58 global TIMEVALUE_ONE_SECOND_IN_USECS
66 if sec
and usec
is None:
74 float(TIMEVALUE_ONE_SECOND_IN_USECS) + dbHalfAdj_)
107 global TIMEVALUE_ONE_SECOND_IN_USECS
113 if self.
tv_sec >= tm.tv_sec:
117 res.tv_sec = self.
tv_sec - tm.tv_sec
118 res.tv_usec = self.
tv_usec - tm.tv_usec
121 res.tv_sec = self.
tv_sec - tm.tv_sec - 1
122 res.tv_usec = (self.
tv_usec + TIMEVALUE_ONE_SECOND_IN_USECS) - tm.tv_usec
127 res.tv_sec = -(tm.tv_sec - self.
tv_sec)
128 res.tv_usec = -(tm.tv_usec - self.
tv_usec)
131 res.tv_sec = -(tm.tv_sec - self.
tv_sec - 1)
132 res.tv_usec = -(tm.tv_usec + TIMEVALUE_ONE_SECOND_IN_USECS) + self.
tv_usec 154 global TIMEVALUE_ONE_SECOND_IN_USECS
156 res.tv_sec = self.
tv_sec + tm.tv_sec
157 res.tv_usec = self.
tv_usec + tm.tv_usec
158 if res.tv_usec > TIMEVALUE_ONE_SECOND_IN_USECS:
160 res.tv_usec -= TIMEVALUE_ONE_SECOND_IN_USECS
190 global TIMEVALUE_ONE_SECOND_IN_USECS
193 self.
tv_usec = long((time - float(self.
tv_sec)) * float(TIMEVALUE_ONE_SECOND_IN_USECS))
210 global TIMEVALUE_ONE_SECOND_IN_USECS
211 return float(self.
tv_sec) + float(self.
tv_usec / float(TIMEVALUE_ONE_SECOND_IN_USECS))
228 global TIMEVALUE_ONE_SECOND_IN_USECS
229 return str(self.
tv_sec + self.
tv_usec / float(TIMEVALUE_ONE_SECOND_IN_USECS))
264 global TIMEVALUE_ONE_SECOND_IN_USECS
265 if self.
tv_usec >= TIMEVALUE_ONE_SECOND_IN_USECS:
267 self.
tv_usec -= TIMEVALUE_ONE_SECOND_IN_USECS
269 while self.
tv_usec >= TIMEVALUE_ONE_SECOND_IN_USECS:
271 self.
tv_usec -= TIMEVALUE_ONE_SECOND_IN_USECS
273 elif self.
tv_usec <= -TIMEVALUE_ONE_SECOND_IN_USECS:
275 self.
tv_usec += TIMEVALUE_ONE_SECOND_IN_USECS
277 while self.
tv_usec <= -TIMEVALUE_ONE_SECOND_IN_USECS:
279 self.
tv_usec += TIMEVALUE_ONE_SECOND_IN_USECS
284 self.
tv_usec += TIMEVALUE_ONE_SECOND_IN_USECS
288 self.
tv_usec -= TIMEVALUE_ONE_SECOND_IN_USECS
def __init__(self, sec=None, usec=None)
def normalize(self)
Normalize.