Bug #7586 TIMEDIFF for sec+microsec not working?
Submitted: 30 Dec 2004 8:54 Modified: 14 Jan 2005 12:00
Reporter: Mark Junker Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.8 OS:Windows (WinXP Pro SP2)
Assigned to: Dmitry Lenev CPU Architecture:Any

[30 Dec 2004 8:54] Mark Junker
Description:
Hi,

when using the timediff() function with a "microsecond" interval greater than 1000000, the result seems to be wrong. The same symptoms appear when using "second_microsecond" as interval and with a "second" value greater than zero. Just take a look about the protocol at the section "How to repeat". The result I'd assume for the last statement would be "-00:00:02.000001" instead of "-00:00:03.999999".

Regards,
Mark

How to repeat:
mysql> select timediff(date_add(now(), interval -2000000 microsecond),now());
+----------------------------------------------------------------+
| timediff(date_add(now(), interval -2000000 microsecond),now()) |
+----------------------------------------------------------------+
| -00:00:02                                                      |
+----------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select timediff(date_add(now(), interval -2000001 microsecond),now());
+----------------------------------------------------------------+
| timediff(date_add(now(), interval -2000001 microsecond),now()) |
+----------------------------------------------------------------+
| -00:00:03.999999                                               |
+----------------------------------------------------------------+
1 row in set (0.00 sec)
[30 Dec 2004 9:36] MySQL Verification Team
Verified with 4.1.9-debug.
OS: Windows, Linux
[14 Jan 2005 12:00] Dmitry Lenev
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Fix will be availiable in 4.1.10