~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/tztime.h

  • Committer: Monty Taylor
  • Date: 2008-11-16 05:36:13 UTC
  • mto: (584.1.9 devel)
  • mto: This revision was merged to the branch mainline in revision 589.
  • Revision ID: monty@inaugust.com-20081116053613-bld4rqxhlkb49c02
Split out cache_row and type_holder.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#ifndef DRIZZLED_TZTIME_H
22
 
#define DRIZZLED_TZTIME_H
23
 
 
24
 
#include <drizzled/memory/sql_alloc.h>
25
 
#include <drizzled/type/time.h>
26
 
 
27
 
#include "drizzled/type/time.h"
28
 
 
29
 
namespace drizzled
30
 
{
31
 
 
32
 
class String;
33
21
 
34
22
/**
35
 
  This class represents abstract time zone and provides
36
 
  basic interface for type::Time <-> type::Time::epoch_t conversion.
37
 
  Actual time zones which are specified by DB, or via offset
 
23
  This class represents abstract time zone and provides 
 
24
  basic interface for DRIZZLE_TIME <-> my_time_t conversion.
 
25
  Actual time zones which are specified by DB, or via offset 
38
26
  or use system functions are its descendants.
39
27
*/
40
 
class Time_zone: public memory::SqlAlloc
 
28
class Time_zone: public Sql_alloc 
41
29
{
42
30
public:
43
31
  Time_zone() {}                              /* Remove gcc warning */
44
32
  /**
45
 
    Converts local time in broken down type::Time representation to
46
 
    type::Time::epoch_t (UTC seconds since Epoch) represenation.
 
33
    Converts local time in broken down DRIZZLE_TIME representation to 
 
34
    my_time_t (UTC seconds since Epoch) represenation.
47
35
    Returns 0 in case of error. Sets in_dst_time_gap to true if date provided
48
36
    falls into spring time-gap (or lefts it untouched otherwise).
49
37
  */
50
 
  virtual type::Time::epoch_t TIME_to_gmt_sec(const type::Time &t,
51
 
                                              bool *in_dst_time_gap) const = 0;
 
38
  virtual my_time_t TIME_to_gmt_sec(const DRIZZLE_TIME *t, 
 
39
                                    bool *in_dst_time_gap) const = 0;
52
40
  /**
53
 
    Converts time in type::Time::epoch_t representation to local time in
54
 
    broken down type::Time representation.
 
41
    Converts time in my_time_t representation to local time in
 
42
    broken down DRIZZLE_TIME representation.
55
43
  */
56
 
  virtual void gmt_sec_to_TIME(type::Time &tmp, type::Time::epoch_t t) const = 0;
57
 
 
 
44
  virtual void   gmt_sec_to_TIME(DRIZZLE_TIME *tmp, my_time_t t) const = 0;
58
45
  /**
59
 
    Because of constness of String returned by get_name() time zone name
 
46
    Because of constness of String returned by get_name() time zone name 
60
47
    have to be already zeroended to be able to use String::ptr() instead
61
48
    of c_ptr().
62
49
  */
63
50
  virtual const String * get_name() const = 0;
64
51
 
65
 
  /**
 
52
  /** 
66
53
    We need this only for surpressing warnings, objects of this type are
67
 
    allocated on memory::Root and should not require destruction.
 
54
    allocated on MEM_ROOT and should not require destruction.
68
55
  */
69
56
  virtual ~Time_zone() {};
70
57
};
71
58
 
 
59
extern Time_zone * my_tz_UTC;
72
60
extern Time_zone * my_tz_SYSTEM;
73
 
Time_zone * my_tz_find(Session *session, const String *name);
74
 
bool     my_tz_init(Session *org_session, const char *default_tzname);
75
 
 
76
 
} /* namespace drizzled */
77
 
 
78
 
#endif /* DRIZZLED_TZTIME_H */
 
61
extern Time_zone * my_tz_OFFSET0;
 
62
extern Time_zone * my_tz_find(Session *session, const String *name);
 
63
extern bool     my_tz_init(Session *org_session, const char *default_tzname);
 
64
extern void        my_tz_free();
 
65
extern my_time_t   sec_since_epoch_TIME(DRIZZLE_TIME *t);