~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/tztime.h

edit

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#ifndef DRIZZLED_TZTIME_H
22
22
#define DRIZZLED_TZTIME_H
23
23
 
24
 
#include <drizzled/memory/sql_alloc.h>
25
 
#include <drizzled/type/time.h>
 
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
26
34
 
27
 
#include <drizzled/type/time.h>
 
35
#include "drizzled/memory/sql_alloc.h"
28
36
 
29
37
namespace drizzled
30
38
{
31
39
 
32
40
class String;
33
41
 
 
42
namespace type {
 
43
class Time;
 
44
}
 
45
 
34
46
/**
35
47
  This class represents abstract time zone and provides
36
 
  basic interface for type::Time <-> type::Time::epoch_t conversion.
 
48
  basic interface for type::Time <-> time_t conversion.
37
49
  Actual time zones which are specified by DB, or via offset
38
50
  or use system functions are its descendants.
39
51
*/
43
55
  Time_zone() {}                              /* Remove gcc warning */
44
56
  /**
45
57
    Converts local time in broken down type::Time representation to
46
 
    type::Time::epoch_t (UTC seconds since Epoch) represenation.
 
58
    time_t (UTC seconds since Epoch) represenation.
47
59
    Returns 0 in case of error. Sets in_dst_time_gap to true if date provided
48
60
    falls into spring time-gap (or lefts it untouched otherwise).
49
61
  */
50
 
  virtual type::Time::epoch_t TIME_to_gmt_sec(const type::Time &t,
51
 
                                              bool *in_dst_time_gap) const = 0;
 
62
  virtual time_t TIME_to_gmt_sec(const type::Time *t,
 
63
                                 bool *in_dst_time_gap) const = 0;
52
64
  /**
53
 
    Converts time in type::Time::epoch_t representation to local time in
 
65
    Converts time in time_t representation to local time in
54
66
    broken down type::Time representation.
55
67
  */
56
 
  virtual void gmt_sec_to_TIME(type::Time &tmp, type::Time::epoch_t t) const = 0;
57
 
 
 
68
  virtual void   gmt_sec_to_TIME(type::Time *tmp, time_t t) const = 0;
58
69
  /**
59
70
    Because of constness of String returned by get_name() time zone name
60
71
    have to be already zeroended to be able to use String::ptr() instead
70
81
};
71
82
 
72
83
extern Time_zone * my_tz_SYSTEM;
73
 
bool     my_tz_init(Session *org_session, const char *default_tzname);
 
84
extern Time_zone * my_tz_find(Session *session, const String *name);
 
85
extern bool     my_tz_init(Session *org_session, const char *default_tzname);
74
86
 
75
87
} /* namespace drizzled */
76
88