Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 21decd8

Browse filesBrowse files
committed
Fix wrong sign with negative zero hour timediff. Fixes PyMySQL#63
1 parent d34fac6 commit 21decd8
Copy full SHA for 21decd8

File tree

Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed

‎MySQLdb/times.py

Copy file name to clipboardExpand all lines: MySQLdb/times.py
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,14 @@ def TimeDelta_or_None(s):
7070
ms = ms.ljust(6, '0')
7171
else:
7272
ms = 0
73+
if h[0] == '-':
74+
isNegative = True
75+
else:
76+
isNegative = False
7377
h, m, s, ms = int(h), int(m), int(s), int(ms)
7478
td = timedelta(hours=abs(h), minutes=m, seconds=s,
7579
microseconds=ms)
76-
if h < 0:
80+
if isNegative:
7781
return -td
7882
else:
7983
return td

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.