51
51
Time_zone_system() {} /* Remove gcc warning */
52
virtual time_t TIME_to_gmt_sec(const type::Time *t,
53
bool *in_dst_time_gap) const;
54
virtual void gmt_sec_to_TIME(type::Time *tmp, time_t t) const;
52
virtual type::Time::epoch_t TIME_to_gmt_sec(const type::Time &t,
53
bool *in_dst_time_gap) const;
54
virtual void gmt_sec_to_TIME(type::Time &tmp, type::Time::epoch_t t) const;
55
55
virtual const String * get_name() const;
61
61
* Converts local time in system time zone in type::Time representation
62
* to its time_t representation.
62
* to its type::Time::epoch_t representation.
65
65
* This method uses system function (localtime_r()) for conversion
66
* local time in system time zone in type::Time structure to its time_t
66
* local time in system time zone in type::Time structure to its type::Time::epoch_t
67
67
* representation. Unlike the same function for Time_zone_db class
68
68
* it it won't handle unnormalized input properly. Still it will
69
* return lowest possible time_t in case of ambiguity or if we
69
* return lowest possible type::Time::epoch_t in case of ambiguity or if we
70
70
* provide time corresponding to the time-gap.
72
72
* You should call init_time() function before using this function.
78
78
* spring time-gap) and is not touched otherwise.
81
* Corresponding time_t value or 0 in case of error
81
* Corresponding type::Time::epoch_t value or 0 in case of error
84
Time_zone_system::TIME_to_gmt_sec(const type::Time *t, bool *in_dst_time_gap) const
84
Time_zone_system::TIME_to_gmt_sec(const type::Time &t, bool *in_dst_time_gap) const
87
return my_system_gmt_sec(t, ¬_used, in_dst_time_gap);
87
type::Time::epoch_t tmp;
88
t.convert(tmp, ¬_used, in_dst_time_gap);
93
* Converts time from UTC seconds since Epoch (time_t) representation
95
* Converts time from UTC seconds since Epoch (type::Time::epoch_t) representation
94
96
* to system local time zone broken-down representation.
96
98
* @param tmp pointer to type::Time structure to fill-in
97
* @param t time_t value to be converted
99
* @param t type::Time::epoch_t value to be converted
99
* Note: We assume that value passed to this function will fit into time_t range
101
* Note: We assume that value passed to this function will fit into type::Time::epoch_t range
100
102
* supported by localtime_r. This conversion is putting restriction on
101
103
* TIMESTAMP range in MySQL. If we can get rid of SYSTEM time zone at least
102
104
* for interaction with client then we can extend TIMESTAMP range down to
103
105
* the 1902 easily.
106
Time_zone_system::gmt_sec_to_TIME(type::Time *tmp, time_t t) const
108
Time_zone_system::gmt_sec_to_TIME(type::Time &tmp, type::Time::epoch_t t) const
109
time_t tmp_t= (time_t)t;
111
localtime_r(&tmp_t, &tmp_tm);
112
localtime_to_TIME(tmp, &tmp_tm);
113
tmp->time_type= DRIZZLE_TIMESTAMP_DATETIME;