Fix fubared TimeDelta_or_None and Time_or_None

This commit is contained in:
adustman
2006-02-27 05:49:26 +00:00
parent e23802d4d0
commit e11b39a4f4

View File

@ -50,8 +50,8 @@ def TimeDelta_or_None(s):
from math import modf from math import modf
try: try:
h, m, s = s.split(':') h, m, s = s.split(':')
td = timedelta(hours=int(h), minutes=int(m), seconds=int(s), td = timedelta(hours=int(h), minutes=int(m), seconds=int(float(s)),
microseconds=int(modf(float(s))[0])*1000000) microseconds=int(modf(float(s))[0]*1000000))
if h < 0: if h < 0:
return -td return -td
else: else:
@ -63,8 +63,8 @@ def Time_or_None(s):
from math import modf from math import modf
try: try:
h, m, s = s.split(':') h, m, s = s.split(':')
return time(hour=int(h), minute=int(m), second=int(s), return time(hour=int(h), minute=int(m), second=int(float(s)),
microsecond=int(modf(float(s))[0])*1000000) microsecond=int(modf(float(s))[0]*1000000))
except: except:
return None return None