~drizzle-trunk/drizzle/development

390.1.2 by Monty Taylor
Fixed copyright headers in drizzled/
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2008 Sun Microsystems
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; either version 2 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 */
1 by brian
clean slate
20
1122.2.10 by Monty Taylor
Fixed all of the include guards.
21
#ifndef DRIZZLED_TZTIME_H
22
#define DRIZZLED_TZTIME_H
1 by brian
clean slate
23
1241.9.46 by Monty Taylor
Removed some more evil.
24
#if TIME_WITH_SYS_TIME
25
# include <sys/time.h>
26
# include <time.h>
27
#else
28
# if HAVE_SYS_TIME_H
29
#  include <sys/time.h>
30
# else
31
#  include <time.h>
32
# endif
33
#endif
34
1253.1.4 by Monty Taylor
Moved sql_alloc into memory.
35
#include "drizzled/memory/sql_alloc.h"
1241.9.12 by Monty Taylor
Trims more out of server_includes.h.
36
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
37
namespace drizzled
38
{
39
1241.9.12 by Monty Taylor
Trims more out of server_includes.h.
40
class String;
1237.9.4 by Padraig O'Sullivan
Removed the inclusion of drizzled/field.h in the server_includes header file.
41
typedef struct st_drizzle_time DRIZZLE_TIME;
42
1 by brian
clean slate
43
/**
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
44
  This class represents abstract time zone and provides
722.1.8 by Monty Taylor
Merged from Toru - removal of my_time_t.
45
  basic interface for DRIZZLE_TIME <-> time_t conversion.
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
46
  Actual time zones which are specified by DB, or via offset
1 by brian
clean slate
47
  or use system functions are its descendants.
48
*/
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
49
class Time_zone: public memory::SqlAlloc
1 by brian
clean slate
50
{
51
public:
52
  Time_zone() {}                              /* Remove gcc warning */
53
  /**
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
54
    Converts local time in broken down DRIZZLE_TIME representation to
722.1.8 by Monty Taylor
Merged from Toru - removal of my_time_t.
55
    time_t (UTC seconds since Epoch) represenation.
1 by brian
clean slate
56
    Returns 0 in case of error. Sets in_dst_time_gap to true if date provided
57
    falls into spring time-gap (or lefts it untouched otherwise).
58
  */
722.1.8 by Monty Taylor
Merged from Toru - removal of my_time_t.
59
  virtual time_t TIME_to_gmt_sec(const DRIZZLE_TIME *t,
1237.9.4 by Padraig O'Sullivan
Removed the inclusion of drizzled/field.h in the server_includes header file.
60
                                 bool *in_dst_time_gap) const = 0;
1 by brian
clean slate
61
  /**
722.1.8 by Monty Taylor
Merged from Toru - removal of my_time_t.
62
    Converts time in time_t representation to local time in
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
63
    broken down DRIZZLE_TIME representation.
1 by brian
clean slate
64
  */
685.3.4 by Toru Maesaka
Fixed the issues pointed out by Jay's code review
65
  virtual void   gmt_sec_to_TIME(DRIZZLE_TIME *tmp, time_t t) const = 0;
1 by brian
clean slate
66
  /**
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
67
    Because of constness of String returned by get_name() time zone name
1 by brian
clean slate
68
    have to be already zeroended to be able to use String::ptr() instead
69
    of c_ptr().
70
  */
71
  virtual const String * get_name() const = 0;
72
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
73
  /**
1 by brian
clean slate
74
    We need this only for surpressing warnings, objects of this type are
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
75
    allocated on memory::Root and should not require destruction.
1 by brian
clean slate
76
  */
77
  virtual ~Time_zone() {};
78
};
79
80
extern Time_zone * my_tz_SYSTEM;
520.1.22 by Brian Aker
Second pass of thd cleanup
81
extern Time_zone * my_tz_find(Session *session, const String *name);
82
extern bool     my_tz_init(Session *org_session, const char *default_tzname);
1122.2.10 by Monty Taylor
Fixed all of the include guards.
83
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
84
} /* namespace drizzled */
85
1122.2.10 by Monty Taylor
Fixed all of the include guards.
86
#endif /* DRIZZLED_TZTIME_H */