Commit c57bbb25 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-17400 The result of TIME('42949672965959-01') depends on architecture

- Fixing portabibily problems in sql-common/my_time.c
  (and additionally in sql/sql_time.cc)

- Re-enabling func_time.test
  Now all new chunks added in MDEV-17351 work fine on all platforms.
parent f3761539
......@@ -22,4 +22,3 @@ innodb_bug12902967 : broken upstream
file_contents : MDEV-6526 these files are not installed anymore
max_statement_time : cannot possibly work, depends on timing
connect-abstract : waiting for libmariadb update
func_time : new tests fail on architectures with sizeof(long)=4. Barkov is working on fixing this.
......@@ -6098,3 +6098,18 @@ Message Truncated incorrect time value: '87648576:59:59.000001'
Level Warning
Code 1292
Message Truncated incorrect time value: '87648576:59:59.000001'
#
# MDEV-17400 The result of TIME('42949672965959-01') depends on architecture
#
SELECT TIME('42949672955959-01'), TIME('42949672965959-01');
TIME('42949672955959-01') TIME('42949672965959-01')
NULL NULL
Warnings:
Warning 1292 Truncated incorrect time value: '42949672955959-01'
Warning 1292 Truncated incorrect time value: '42949672965959-01'
SELECT TIME('18446744073709551615-01'), TIME('18446744073709551616-01');
TIME('18446744073709551615-01') TIME('18446744073709551616-01')
NULL NULL
Warnings:
Warning 1292 Truncated incorrect time value: '18446744073709551615-01'
Warning 1292 Truncated incorrect time value: '18446744073709551616-01'
......@@ -3006,3 +3006,11 @@ SELECT
--horizontal_results
--echo #
--echo # MDEV-17400 The result of TIME('42949672965959-01') depends on architecture
--echo #
SELECT TIME('42949672955959-01'), TIME('42949672965959-01');
SELECT TIME('18446744073709551615-01'), TIME('18446744073709551616-01');
......@@ -610,7 +610,11 @@ str_to_DDhhmmssff_internal(my_bool neg, const char *str, size_t length,
l_time->neg= neg;
/* Not a timestamp. Try to get this as a DAYS TO SECOND string */
for (value=0; str != end && my_isdigit(&my_charset_latin1,*str) ; str++)
{
value=value*10L + (long) (*str - '0');
if (value >= 42949672955959ULL) /* i.e. UINT_MAX32 : 59 : 59 */
goto err;
}
/* Skip all space after 'days' */
end_of_days= str;
......@@ -629,6 +633,8 @@ str_to_DDhhmmssff_internal(my_bool neg, const char *str, size_t length,
my_isdigit(&my_charset_latin1, str[1]))
{
date[0]= 0; /* Assume we found hours */
if (value >= UINT_MAX32)
goto err;
date[1]= (ulong) value;
state=2;
found_hours=1;
......@@ -638,6 +644,7 @@ str_to_DDhhmmssff_internal(my_bool neg, const char *str, size_t length,
{
/* String given as one number; assume HHMMSS format */
date[0]= 0;
DBUG_ASSERT(value <= ((ulonglong) UINT_MAX32) * 10000ULL);
date[1]= (ulong) (value/10000);
date[2]= (ulong) (value/100 % 100);
date[3]= (ulong) (value % 100);
......
......@@ -1117,10 +1117,10 @@ calc_time_diff(const MYSQL_TIME *l_time1, const MYSQL_TIME *l_time2,
}
microseconds= ((longlong)days * SECONDS_IN_24H +
(longlong)(l_time1->hour*3600L +
(longlong)(l_time1->hour*3600LL +
l_time1->minute*60L +
l_time1->second) -
l_sign*(longlong)(l_time2->hour*3600L +
l_sign*(longlong)(l_time2->hour*3600LL +
l_time2->minute*60L +
l_time2->second)) * 1000000LL +
(longlong)l_time1->second_part -
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment