MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tztime.h
1 #ifndef TZTIME_INCLUDED
2 #define TZTIME_INCLUDED
3 
4 /* Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; version 2 of the License.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software Foundation,
17  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
18 
19 
20 #include "my_time.h" /* my_time_t */
21 #include "mysql_time.h" /* MYSQL_TIME */
22 #include "sql_alloc.h"
23 #include "sql_string.h" /* String */
24 
25 class THD;
26 
27 #if !defined(TESTTIME) && !defined(TZINFO2SQL)
28 
29 class THD;
30 
37 class Time_zone: public Sql_alloc
38 {
39 public:
40  Time_zone() {} /* Remove gcc warning */
47  virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t,
48  my_bool *in_dst_time_gap) const = 0;
53  virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const = 0;
58  void gmt_sec_to_TIME(MYSQL_TIME *tmp, struct timeval tv)
59  {
60  gmt_sec_to_TIME(tmp, (my_time_t) tv.tv_sec);
61  tmp->second_part= tv.tv_usec;
62  }
68  virtual const String * get_name() const = 0;
69 
74  virtual ~Time_zone() {};
75 
76 protected:
77  static inline void adjust_leap_second(MYSQL_TIME *t);
78 };
79 
80 extern Time_zone * my_tz_UTC;
81 extern Time_zone * my_tz_SYSTEM;
82 extern Time_zone * my_tz_OFFSET0;
83 extern Time_zone * my_tz_find(THD *thd, const String *name);
84 extern my_bool my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap);
85 extern void my_tz_free();
86 extern my_time_t sec_since_epoch_TIME(MYSQL_TIME *t);
87 
95 static const int MY_TZ_TABLES_COUNT= 4;
96 
97 
98 #endif /* !defined(TESTTIME) && !defined(TZINFO2SQL) */
99 #endif /* TZTIME_INCLUDED */