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
|
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
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user