1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

5.5 merge

This commit is contained in:
Sergei Golubchik
2013-12-15 15:57:26 +01:00
71 changed files with 582 additions and 180 deletions

View File

@ -1085,3 +1085,22 @@ int my_time_compare(MYSQL_TIME *a, MYSQL_TIME *b)
return 0;
}
/*
Convert a TIME value to DAY-TIME interval, e.g. for extraction:
EXTRACT(DAY FROM x), EXTRACT(HOUR FROM x), etc.
Moves full days from ltime->hour to ltime->day.
Note, time_type is set to MYSQL_TIMESTAMP_NONE, to make sure that
the structure is not used for anything else other than extraction:
non-extraction TIME functions expect zero day value!
*/
void time_to_daytime_interval(MYSQL_TIME *ltime)
{
DBUG_ASSERT(ltime->time_type == MYSQL_TIMESTAMP_TIME);
DBUG_ASSERT(ltime->year == 0);
DBUG_ASSERT(ltime->month == 0);
DBUG_ASSERT(ltime->day == 0);
ltime->day= ltime->hour / 24;
ltime->hour%= 24;
ltime->time_type= MYSQL_TIMESTAMP_NONE;
}