mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2026-03-13 08:00:02 +08:00
Fix wrong sign with negative zero hour timediff. Fixes #63
This commit is contained in:
@@ -70,10 +70,14 @@ def TimeDelta_or_None(s):
|
||||
ms = ms.ljust(6, '0')
|
||||
else:
|
||||
ms = 0
|
||||
if h[0] == '-':
|
||||
isNegative = True
|
||||
else:
|
||||
isNegative = False
|
||||
h, m, s, ms = int(h), int(m), int(s), int(ms)
|
||||
td = timedelta(hours=abs(h), minutes=m, seconds=s,
|
||||
microseconds=ms)
|
||||
if h < 0:
|
||||
if isNegative:
|
||||
return -td
|
||||
else:
|
||||
return td
|
||||
|
||||
Reference in New Issue
Block a user