mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-15 11:10:58 +08:00
Fix fubared TimeDelta_or_None and Time_or_None
This commit is contained in:
@ -50,8 +50,8 @@ def TimeDelta_or_None(s):
|
||||
from math import modf
|
||||
try:
|
||||
h, m, s = s.split(':')
|
||||
td = timedelta(hours=int(h), minutes=int(m), seconds=int(s),
|
||||
microseconds=int(modf(float(s))[0])*1000000)
|
||||
td = timedelta(hours=int(h), minutes=int(m), seconds=int(float(s)),
|
||||
microseconds=int(modf(float(s))[0]*1000000))
|
||||
if h < 0:
|
||||
return -td
|
||||
else:
|
||||
@ -63,8 +63,8 @@ def Time_or_None(s):
|
||||
from math import modf
|
||||
try:
|
||||
h, m, s = s.split(':')
|
||||
return time(hour=int(h), minute=int(m), second=int(s),
|
||||
microsecond=int(modf(float(s))[0])*1000000)
|
||||
return time(hour=int(h), minute=int(m), second=int(float(s)),
|
||||
microsecond=int(modf(float(s))[0]*1000000))
|
||||
except:
|
||||
return None
|
||||
|
||||
|
Reference in New Issue
Block a user