summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_time.test
diff options
context:
space:
mode:
authorsasha@mysql.sashanet.com <>2001-08-16 12:01:35 -0600
committersasha@mysql.sashanet.com <>2001-08-16 12:01:35 -0600
commit8ca3b53af32fb82dfd4aa7c1d540726640e8ed02 (patch)
treedcd5183294961fc8a3d569157a27e401d484b2c2 /mysql-test/t/func_time.test
parentc68d7caa0677338617b03cc1eb720ae9d7bfc3af (diff)
downloadmariadb-git-8ca3b53af32fb82dfd4aa7c1d540726640e8ed02.tar.gz
fixed bug in Item_func_div::val_int() that broke all functions that
do val_int() on their arguments before starting the computation. Similar fixes are need for +-* and probably several other but I want to make sure Monty is fine with my fix approach before changing a lot of code. Amazingly, this bug is not as critical as you would expect since very few functions do val_int() on their arguments ( from_unixtime(), sec_to_time()), and those not very frequently perform a computation on their floating point arguments. which is probably why no one has yet reported this bug. Another possibility is that the result is usually wrong by no more than 5%, which makes it hard to catch it. I found it when trying to compute mile splits for 30:47 10K - it told me 5:07, and I knew it was wrong because 5:00 mile gives you 31:08. However, if I had not run as many 10K races, I would have easily believed that 30:47 10K is a 5:07 mile pace and would not have noticed the bug.
Diffstat (limited to 'mysql-test/t/func_time.test')
-rw-r--r--mysql-test/t/func_time.test3
1 files changed, 2 insertions, 1 deletions
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index a91844ab986..cb021d25ae3 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -7,7 +7,8 @@ select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days(
select period_add("9602",-12),period_diff(199505,"9404") ;
select now()-now(),weekday(curdate())-weekday(now()),unix_timestamp()-unix_timestamp(now());
select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0;
-select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22");
+select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"),
+ sec_to_time(time_to_sec("0:30:47")/6.21);
select now()-curdate()*1000000-curtime();
select strcmp(current_timestamp(),concat(current_date()," ",current_time()));
select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w");