1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems, Inc.
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.
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.
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
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
#include <drizzled/tztime.h>
24
#include <drizzled/gettext.h>
25
#include <drizzled/session.h>
26
#include <drizzled/time_functions.h>
27
#include <drizzled/charset.h>
32
* String with names of SYSTEM time zone.
34
static const String tz_SYSTEM_name("SYSTEM", 6, &my_charset_utf8_general_ci);
38
* Instance of this class represents local time zone used on this system
39
* (specified by TZ environment variable or via any other system mechanism).
40
* It uses system functions (localtime_r, my_system_gmt_sec) for conversion
41
* and is always available. Because of this it is used by default - if there
42
* were no explicit time zone specified. On the other hand because of this
43
* conversion methods provided by this class is significantly slower and
44
* possibly less multi-threaded-friendly than corresponding Time_zone_db
45
* methods so the latter should be preffered there it is possible.
47
class Time_zone_system : public Time_zone
50
virtual void gmt_sec_to_TIME(type::Time &tmp, type::Time::epoch_t t) const;
56
* Converts time from UTC seconds since Epoch (type::Time::epoch_t) representation
57
* to system local time zone broken-down representation.
59
* @param tmp pointer to type::Time structure to fill-in
60
* @param t type::Time::epoch_t value to be converted
62
* Note: We assume that value passed to this function will fit into type::Time::epoch_t range
63
* supported by localtime_r. This conversion is putting restriction on
64
* TIMESTAMP range in MySQL. If we can get rid of SYSTEM time zone at least
65
* for interaction with client then we can extend TIMESTAMP range down to
69
Time_zone_system::gmt_sec_to_TIME(type::Time &tmp, type::Time::epoch_t t) const
75
static Time_zone_system tz_SYSTEM;
77
Time_zone *my_tz_SYSTEM= &tz_SYSTEM;
79
} /* namespace drizzled */