Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
5475e892
Commit
5475e892
authored
Mar 26, 2007
by
monty@mysql.com/narttu.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed error found by valgrind in numerical date handling
Fixed comments to say MYSQL_TIME instead of old typedef TIME
parent
28a05d3b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
sql-common/my_time.c
sql-common/my_time.c
+12
-11
No files found.
sql-common/my_time.c
View file @
5475e892
...
...
@@ -456,7 +456,7 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
/*
Convert a time string to a TIME struct.
Convert a time string to a
MYSQL_
TIME struct.
SYNOPSIS
str_to_time()
...
...
@@ -642,11 +642,11 @@ my_bool str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
l_time
->
second_part
=
date
[
4
];
l_time
->
time_type
=
MYSQL_TIMESTAMP_TIME
;
/* Check if the value is valid and fits into TIME range */
/* Check if the value is valid and fits into
MYSQL_
TIME range */
if
(
check_time_range
(
l_time
,
warning
))
return
1
;
/* Check if there is garbage at end of the TIME specification */
/* Check if there is garbage at end of the
MYSQL_
TIME specification */
if
(
str
!=
end
)
{
do
...
...
@@ -663,11 +663,11 @@ my_bool str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
/*
Check 'time' value to lie in the TIME range
Check 'time' value to lie in the
MYSQL_
TIME range
SYNOPSIS:
check_time_range()
time pointer to TIME value
time pointer to
MYSQL_
TIME value
warning set MYSQL_TIME_WARN_OUT_OF_RANGE flag if the value is out of range
DESCRIPTION
...
...
@@ -1008,7 +1008,7 @@ void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type)
/*
Functions to convert time/date/datetime value to a string,
using default format.
This functions don't check that given TIME structure members are
This functions don't check that given
MYSQL_
TIME structure members are
in valid range. If they are not, return value won't reflect any
valid date either. Additionally, make_time doesn't take into
account time->day member: it's assumed that days have been converted
...
...
@@ -1094,7 +1094,7 @@ int my_TIME_to_str(const MYSQL_TIME *l_time, char *to)
DESCRIPTION
Convert a datetime value of formats YYMMDD, YYYYMMDD, YYMMDDHHMSS,
YYYYMMDDHHMMSS to broken-down TIME representation. Return value in
YYYYMMDDHHMMSS to broken-down
MYSQL_
TIME representation. Return value in
YYYYMMDDHHMMSS format as side-effect.
This function also checks if datetime value fits in DATETIME range.
...
...
@@ -1150,6 +1150,7 @@ longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
ok:
part1
=
(
long
)
(
nr
/
LL
(
1000000
));
part2
=
(
long
)
(
nr
-
(
longlong
)
part1
*
LL
(
1000000
));
time_res
->
neg
=
0
;
time_res
->
year
=
(
int
)
(
part1
/
10000L
);
part1
%=
10000L
;
time_res
->
month
=
(
int
)
part1
/
100
;
time_res
->
day
=
(
int
)
part1
%
100
;
...
...
@@ -1186,7 +1187,7 @@ ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *my_time)
}
/* Convert TIME value to integer in YYYYMMDD format */
/* Convert
MYSQL_
TIME value to integer in YYYYMMDD format */
ulonglong
TIME_to_ulonglong_date
(
const
MYSQL_TIME
*
my_time
)
{
...
...
@@ -1196,7 +1197,7 @@ ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *my_time)
/*
Convert TIME value to integer in HHMMSS format.
Convert
MYSQL_
TIME value to integer in HHMMSS format.
This function doesn't take into account time->day member:
it's assumed that days have been converted to hours already.
*/
...
...
@@ -1210,7 +1211,7 @@ ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *my_time)
/*
Convert struct TIME (date and time split into year/month/day/hour/...
Convert struct
MYSQL_
TIME (date and time split into year/month/day/hour/...
to a number in format YYYYMMDDHHMMSS (DATETIME),
YYYYMMDD (DATE) or HHMMSS (TIME).
...
...
@@ -1224,7 +1225,7 @@ ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *my_time)
SELECT ?+1;
NOTE
This function doesn't check that given TIME structure members are
This function doesn't check that given
MYSQL_
TIME structure members are
in valid range. If they are not, return value won't reflect any
valid date either.
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment