| Bug #8068 | TIMEDIFF with first negative argument gives wrong result | ||
|---|---|---|---|
| Submitted: | 21 Jan 2005 13:20 | Modified: | 20 Apr 2005 1:41 |
| Reporter: | Dmitry Lenev | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 4.1.9 | OS: | Any (Any) |
| Assigned to: | Dmitry Lenev | CPU Architecture: | Any |
[28 Mar 2005 12:19]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/internals/23413
[18 Apr 2005 11:57]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/internals/24108
[18 Apr 2005 18:26]
Dmitry Lenev
Fixed in 4.1.12 and 5.0.5
[20 Apr 2005 1:41]
Paul DuBois
Noted in 4.1.12, 5.0.5 changelogs.

Description: TIMEDIFF() function gives wrong result if its first argument is negative time value and its second is positive time value. How to repeat: mysql> select timediff('01:00:00', '02:00:00'); +---------------------------------+ | timediff('01:00:00','02:00:00') | +---------------------------------+ | -01:00:00 | +---------------------------------+ 1 row in set (0.00 sec) # RIGHT: 1 - 2 = -1 mysql> select timediff('-01:00:00', '02:00:00'); +----------------------------------+ | timediff('-01:00:00','02:00:00') | +----------------------------------+ | 03:00:00 | +----------------------------------+ 1 row in set (0.00 sec) # WRONG: -1 - 2 = -3 ! mysql> select timediff('01:00:00', '-02:00:00'); +----------------------------------+ | timediff('01:00:00','-02:00:00') | +----------------------------------+ | 03:00:00 | +----------------------------------+ 1 row in set (0.00 sec) # RIGHT: 1 - (-2) = 3 mysql> select timediff('-01:00:00', '-02:00:00'); +-----------------------------------+ | timediff('-01:00:00','-02:00:00') | +-----------------------------------+ | 01:00:00 | +-----------------------------------+ 1 row in set (0.00 sec) # RIGHT: -1 - (-2) = 1