Eneboo - Documentación para desarrolladores
|
00001 /* Copyright (C) 2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; either version 2 of the License, or 00006 (at your option) any later version. 00007 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 00016 00017 /* 00018 This is a private header of sql-common library, containing 00019 declarations for my_time.c 00020 */ 00021 00022 #ifndef _my_time_h_ 00023 #define _my_time_h_ 00024 #include "my_global.h" 00025 #include "mysql_time.h" 00026 00027 C_MODE_START 00028 00029 extern ulonglong log_10_int[20]; 00030 extern uchar days_in_month[]; 00031 00032 /* 00033 Portable time_t replacement. 00034 Should be signed and hold seconds for 1902-2038 range. 00035 */ 00036 typedef long my_time_t; 00037 00038 #define MY_TIME_T_MAX LONG_MAX 00039 #define MY_TIME_T_MIN LONG_MIN 00040 00041 #define YY_PART_YEAR 70 00042 00043 /* Flags to str_to_datetime */ 00044 #define TIME_FUZZY_DATE 1 00045 #define TIME_DATETIME_ONLY 2 00046 00047 enum enum_mysql_timestamp_type 00048 str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time, 00049 uint flags, int *was_cut); 00050 00051 bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time, 00052 int *was_cut); 00053 00054 long calc_daynr(uint year,uint month,uint day); 00055 00056 void init_time(void); 00057 00058 my_time_t 00059 my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap); 00060 00061 void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type); 00062 00063 /* 00064 Required buffer length for my_time_to_str, my_date_to_str, 00065 my_datetime_to_str and TIME_to_string functions. Note, that the 00066 caller is still responsible to check that given TIME structure 00067 has values in valid ranges, otherwise size of the buffer could 00068 be not enough. We also rely on the fact that even wrong values 00069 sent using binary protocol fit in this buffer. 00070 */ 00071 #define MAX_DATE_STRING_REP_LENGTH 30 00072 00073 int my_time_to_str(const MYSQL_TIME *l_time, char *to); 00074 int my_date_to_str(const MYSQL_TIME *l_time, char *to); 00075 int my_datetime_to_str(const MYSQL_TIME *l_time, char *to); 00076 int my_TIME_to_str(const MYSQL_TIME *l_time, char *to); 00077 00078 C_MODE_END 00079 00080 #endif /* _my_time_h_ */