00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- 00002 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 00003 * 00004 * Copyright (C) 2008 Sun Microsystems, Inc. 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 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 */ 00019 00020 00021 #include <config.h> 00022 #include <cstdio> 00023 #include <drizzled/tztime.h> 00024 #include <drizzled/gettext.h> 00025 #include <drizzled/session.h> 00026 #include <drizzled/time_functions.h> 00027 00028 namespace drizzled 00029 { 00030 00034 static const String tz_SYSTEM_name("SYSTEM", 6, &my_charset_utf8_general_ci); 00035 00036 00047 class Time_zone_system : public Time_zone 00048 { 00049 public: 00050 Time_zone_system() {} /* Remove gcc warning */ 00051 virtual type::Time::epoch_t TIME_to_gmt_sec(const type::Time &t, 00052 bool *in_dst_time_gap) const; 00053 virtual void gmt_sec_to_TIME(type::Time &tmp, type::Time::epoch_t t) const; 00054 virtual const String * get_name() const; 00055 }; 00056 00057 00082 type::Time::epoch_t 00083 Time_zone_system::TIME_to_gmt_sec(const type::Time &t, bool *in_dst_time_gap) const 00084 { 00085 long not_used; 00086 type::Time::epoch_t tmp; 00087 t.convert(tmp, ¬_used, in_dst_time_gap); 00088 return tmp; 00089 } 00090 00091 00106 void 00107 Time_zone_system::gmt_sec_to_TIME(type::Time &tmp, type::Time::epoch_t t) const 00108 { 00109 tmp.store(t); 00110 } 00111 00112 00120 const String * 00121 Time_zone_system::get_name() const 00122 { 00123 return &tz_SYSTEM_name; 00124 } 00125 00126 static Time_zone_system tz_SYSTEM; 00127 00128 Time_zone *my_tz_SYSTEM= &tz_SYSTEM; 00129 00130 } /* namespace drizzled */