~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.12 by Monty Taylor
Trims more out of server_includes.h.
24
#include "drizzled/sql_alloc.h"
25
26
class String;
1237.9.4 by Padraig O'Sullivan
Removed the inclusion of drizzled/field.h in the server_includes header file.
27
typedef struct st_drizzle_time DRIZZLE_TIME;
28
1 by brian
clean slate
29
/**
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
30
  This class represents abstract time zone and provides
722.1.8 by Monty Taylor
Merged from Toru - removal of my_time_t.
31
  basic interface for DRIZZLE_TIME <-> time_t conversion.
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
32
  Actual time zones which are specified by DB, or via offset
1 by brian
clean slate
33
  or use system functions are its descendants.
34
*/
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
35
class Time_zone: public Sql_alloc
1 by brian
clean slate
36
{
37
public:
38
  Time_zone() {}                              /* Remove gcc warning */
39
  /**
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
40
    Converts local time in broken down DRIZZLE_TIME representation to
722.1.8 by Monty Taylor
Merged from Toru - removal of my_time_t.
41
    time_t (UTC seconds since Epoch) represenation.
1 by brian
clean slate
42
    Returns 0 in case of error. Sets in_dst_time_gap to true if date provided
43
    falls into spring time-gap (or lefts it untouched otherwise).
44
  */
722.1.8 by Monty Taylor
Merged from Toru - removal of my_time_t.
45
  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.
46
                                 bool *in_dst_time_gap) const = 0;
1 by brian
clean slate
47
  /**
722.1.8 by Monty Taylor
Merged from Toru - removal of my_time_t.
48
    Converts time in time_t representation to local time in
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
49
    broken down DRIZZLE_TIME representation.
1 by brian
clean slate
50
  */
685.3.4 by Toru Maesaka
Fixed the issues pointed out by Jay's code review
51
  virtual void   gmt_sec_to_TIME(DRIZZLE_TIME *tmp, time_t t) const = 0;
1 by brian
clean slate
52
  /**
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
53
    Because of constness of String returned by get_name() time zone name
1 by brian
clean slate
54
    have to be already zeroended to be able to use String::ptr() instead
55
    of c_ptr().
56
  */
57
  virtual const String * get_name() const = 0;
58
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
59
  /**
1 by brian
clean slate
60
    We need this only for surpressing warnings, objects of this type are
61
    allocated on MEM_ROOT and should not require destruction.
62
  */
63
  virtual ~Time_zone() {};
64
};
65
66
extern Time_zone * my_tz_SYSTEM;
520.1.22 by Brian Aker
Second pass of thd cleanup
67
extern Time_zone * my_tz_find(Session *session, const String *name);
68
extern bool     my_tz_init(Session *org_session, const char *default_tzname);
722.1.8 by Monty Taylor
Merged from Toru - removal of my_time_t.
69
extern time_t   sec_since_epoch_TIME(DRIZZLE_TIME *t);
1122.2.10 by Monty Taylor
Fixed all of the include guards.
70
71
#endif /* DRIZZLED_TZTIME_H */