OSDN Git Service

First version
[st-ro/stro.git] / 3rdparty / mysql / include / mysql_time.h
1 /* Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
2
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation; version 2 of the License.
6
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  GNU General Public License for more details.
11
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software
14  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
15
16 #ifndef _mysql_time_h_
17 #define _mysql_time_h_
18
19 /*
20   Time declarations shared between the server and client API:
21   you should not add anything to this header unless it's used
22   (and hence should be visible) in mysql.h.
23   If you're looking for a place to add new time-related declaration,
24   it's most likely my_time.h. See also "C API Handling of Date
25   and Time Values" chapter in documentation.
26 */
27
28 enum enum_mysql_timestamp_type
29 {
30   MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
31   MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
32 };
33
34
35 /*
36   Structure which is used to represent datetime values inside MySQL.
37
38   We assume that values in this structure are normalized, i.e. year <= 9999,
39   month <= 12, day <= 31, hour <= 23, hour <= 59, hour <= 59. Many functions
40   in server such as my_system_gmt_sec() or make_time() family of functions
41   rely on this (actually now usage of make_*() family relies on a bit weaker
42   restriction). Also functions that produce MYSQL_TIME as result ensure this.
43   There is one exception to this rule though if this structure holds time
44   value (time_type == MYSQL_TIMESTAMP_TIME) days and hour member can hold
45   bigger values.
46 */
47 typedef struct st_mysql_time
48 {
49   unsigned int  year, month, day, hour, minute, second;
50   unsigned long second_part;  /**< microseconds */
51   my_bool       neg;
52   enum enum_mysql_timestamp_type time_type;
53 } MYSQL_TIME;
54
55 #endif /* _mysql_time_h_ */