1#ifndef MYSQL_SERVICE_THD_TIMEZONE_INCLUDED
2/* Copyright (C) 2013 MariaDB Foundation.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; version 2 of the License.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
16
17/**
18 @file
19 This service provdes functions to convert between my_time_t and
20 MYSQL_TIME taking into account the current value of the time_zone
21 session variable.
22
23 The values of the my_time_t type are in Unix timestamp format,
24 i.e. the number of seconds since "1970-01-01 00:00:00 UTC".
25
26 The values of the MYSQL_TIME type are in the current time zone,
27 according to thd->variables.time_zone.
28
29 If the MYSQL_THD parameter is NULL, then global_system_variables.time_zone
30 is used for conversion.
31*/
32
33#ifndef MYSQL_ABI_CHECK
34/*
35 This service currently does not depend on any system headers.
36 If it needs system headers in the future, make sure to put
37 them inside this ifndef.
38*/
39#endif
40
41#include "mysql_time.h"
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47
48extern struct thd_timezone_service_st {
49 my_time_t (*thd_TIME_to_gmt_sec)(MYSQL_THD thd, const MYSQL_TIME *ltime, unsigned int *errcode);
50 void (*thd_gmt_sec_to_TIME)(MYSQL_THD thd, MYSQL_TIME *ltime, my_time_t t);
51} *thd_timezone_service;
52
53#ifdef MYSQL_DYNAMIC_PLUGIN
54
55#define thd_TIME_to_gmt_sec(thd, ltime, errcode) \
56 (thd_timezone_service->thd_TIME_to_gmt_sec((thd), (ltime), (errcode)))
57
58#define thd_gmt_sec_to_TIME(thd, ltime, t) \
59 (thd_timezone_service->thd_gmt_sec_to_TIME((thd), (ltime), (t)))
60
61#else
62
63my_time_t thd_TIME_to_gmt_sec(MYSQL_THD thd, const MYSQL_TIME *ltime, unsigned int *errcode);
64void thd_gmt_sec_to_TIME(MYSQL_THD thd, MYSQL_TIME *ltime, my_time_t t);
65
66#endif
67
68#ifdef __cplusplus
69}
70#endif
71
72#define MYSQL_SERVICE_THD_TIMEZONE_INCLUDED
73#endif
74