mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
sec_to_time() in the integer context was losing the sign of the result
This commit is contained in:
parent
26bd06feef
commit
11ebbabb08
3 changed files with 8 additions and 1 deletions
|
@ -27,6 +27,10 @@ sec_to_time('9001.1') sec_to_time('1234567890123.123')
|
|||
02:30:01.100000 838:59:59.999999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '1234567890123.123'
|
||||
select sec_to_time(-9001.1), sec_to_time(-9001.1) / 1,
|
||||
sec_to_time(-9001.1) / 1e0, sec_to_time(-9001) div 1;
|
||||
sec_to_time(-9001.1) sec_to_time(-9001.1) / 1 sec_to_time(-9001.1) / 1e0 sec_to_time(-9001) div 1
|
||||
-02:30:01.1 -23001.10000 -23001.1 -23001
|
||||
select sec_to_time(90011e-1), sec_to_time(1234567890123e30);
|
||||
sec_to_time(90011e-1) sec_to_time(1234567890123e30)
|
||||
02:30:01.100000 838:59:59.999999
|
||||
|
|
|
@ -18,6 +18,8 @@ select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"),
|
|||
select sec_to_time(9001.1), time_to_sec('15:12:22.123456'), time_to_sec(15.5566778899);
|
||||
select sec_to_time(time_to_sec('-838:59:59'));
|
||||
select sec_to_time('9001.1'), sec_to_time('1234567890123.123');
|
||||
select sec_to_time(-9001.1), sec_to_time(-9001.1) / 1,
|
||||
sec_to_time(-9001.1) / 1e0, sec_to_time(-9001) div 1;
|
||||
--replace_result e+042 e+42
|
||||
select sec_to_time(90011e-1), sec_to_time(1234567890123e30);
|
||||
select sec_to_time(1234567890123), sec_to_time('99999999999999999999999999999');
|
||||
|
|
|
@ -1370,7 +1370,8 @@ longlong Item_temporal_func::val_int()
|
|||
MYSQL_TIME ltime;
|
||||
if (get_date(<ime, TIME_FUZZY_DATE))
|
||||
return 0;
|
||||
return (longlong)TIME_to_ulonglong(<ime);
|
||||
longlong v= TIME_to_ulonglong(<ime);
|
||||
return ltime.neg ? -v : v;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue