~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/tztime.cc

  • Committer: Olaf van der Spek
  • Date: 2011-04-16 13:00:30 UTC
  • mto: (2280.2.3 build)
  • mto: This revision was merged to the branch mainline in revision 2281.
  • Revision ID: olafvdspek@gmail.com-20110416130030-53mitypb2aenxpkb
Prune

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
class Time_zone_system : public Time_zone
48
48
{
49
49
public:
50
 
  Time_zone_system() {}                       /* Remove gcc warning */
51
 
  virtual type::Time::epoch_t TIME_to_gmt_sec(const type::Time &t,
52
 
                                              bool *in_dst_time_gap) const;
53
50
  virtual void gmt_sec_to_TIME(type::Time &tmp, type::Time::epoch_t t) const;
54
 
  virtual const String * get_name() const;
55
51
};
56
52
 
57
53
 
58
54
/**
59
55
 * @brief
60
 
 * Converts local time in system time zone in type::Time representation
61
 
 * to its type::Time::epoch_t representation.
62
 
 *
63
 
 * @details
64
 
 * This method uses system function (localtime_r()) for conversion
65
 
 * local time in system time zone in type::Time structure to its type::Time::epoch_t
66
 
 * representation. Unlike the same function for Time_zone_db class
67
 
 * it it won't handle unnormalized input properly. Still it will
68
 
 * return lowest possible type::Time::epoch_t in case of ambiguity or if we
69
 
 * provide time corresponding to the time-gap.
70
 
 *
71
 
 * You should call init_time() function before using this function.
72
 
 *
73
 
 * @param   t               pointer to type::Time structure with local time in
74
 
 *                          broken-down representation.
75
 
 * @param   in_dst_time_gap pointer to bool which is set to true if datetime
76
 
 *                          value passed doesn't really exist (i.e. falls into
77
 
 *                          spring time-gap) and is not touched otherwise.
78
 
 *
79
 
 * @return
80
 
 * Corresponding type::Time::epoch_t value or 0 in case of error
81
 
 */
82
 
type::Time::epoch_t
83
 
Time_zone_system::TIME_to_gmt_sec(const type::Time &t, bool *in_dst_time_gap) const
84
 
{
85
 
  long not_used;
86
 
  type::Time::epoch_t tmp;
87
 
  t.convert(tmp, &not_used, in_dst_time_gap);
88
 
  return tmp;
89
 
}
90
 
 
91
 
 
92
 
/**
93
 
 * @brief
94
56
 * Converts time from UTC seconds since Epoch (type::Time::epoch_t) representation
95
57
 * to system local time zone broken-down representation.
96
58
 *
110
72
}
111
73
 
112
74
 
113
 
/**
114
 
 * @brief
115
 
 * Get name of time zone
116
 
 *
117
 
 * @return
118
 
 * Name of time zone as String
119
 
 */
120
 
const String *
121
 
Time_zone_system::get_name() const
122
 
{
123
 
  return &tz_SYSTEM_name;
124
 
}
125
 
 
126
75
static Time_zone_system tz_SYSTEM;
127
76
 
128
77
Time_zone *my_tz_SYSTEM= &tz_SYSTEM;