My Project
|
00001 #ifndef TZTIME_INCLUDED 00002 #define TZTIME_INCLUDED 00003 00004 /* Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; version 2 of the License. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software Foundation, 00017 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ 00018 00019 00020 #include "my_time.h" /* my_time_t */ 00021 #include "mysql_time.h" /* MYSQL_TIME */ 00022 #include "sql_alloc.h" 00023 #include "sql_string.h" /* String */ 00024 00025 class THD; 00026 00027 #if !defined(TESTTIME) && !defined(TZINFO2SQL) 00028 00029 class THD; 00030 00037 class Time_zone: public Sql_alloc 00038 { 00039 public: 00040 Time_zone() {} /* Remove gcc warning */ 00047 virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t, 00048 my_bool *in_dst_time_gap) const = 0; 00053 virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const = 0; 00058 void gmt_sec_to_TIME(MYSQL_TIME *tmp, struct timeval tv) 00059 { 00060 gmt_sec_to_TIME(tmp, (my_time_t) tv.tv_sec); 00061 tmp->second_part= tv.tv_usec; 00062 } 00068 virtual const String * get_name() const = 0; 00069 00074 virtual ~Time_zone() {}; 00075 00076 protected: 00077 static inline void adjust_leap_second(MYSQL_TIME *t); 00078 }; 00079 00080 extern Time_zone * my_tz_UTC; 00081 extern Time_zone * my_tz_SYSTEM; 00082 extern Time_zone * my_tz_OFFSET0; 00083 extern Time_zone * my_tz_find(THD *thd, const String *name); 00084 extern my_bool my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap); 00085 extern void my_tz_free(); 00086 extern my_time_t sec_since_epoch_TIME(MYSQL_TIME *t); 00087 00095 static const int MY_TZ_TABLES_COUNT= 4; 00096 00097 00098 #endif /* !defined(TESTTIME) && !defined(TZINFO2SQL) */ 00099 #endif /* TZTIME_INCLUDED */