~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/tztime.h

  • Committer: Brian Aker
  • Date: 2011-02-22 06:12:02 UTC
  • mfrom: (2190.1.6 drizzle-build)
  • Revision ID: brian@tangent.org-20110222061202-k03czxykqy4x9hjs
List update, header fixes, multiple symbols, and David deletes some code.

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