~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/time_functions.cc

  • Committer: David Shrewsbury
  • Date: 2011-01-13 18:43:55 UTC
  • mto: (2081.1.2 drizzle)
  • mto: This revision was merged to the branch mainline in revision 2082.
  • Revision ID: shrewsbury.dave@gmail.com-20110113184355-wsmu0grg7tkxwdsc
Push ALTER SCHEMA through replication stream as proper GPB message instead of RAW_SQL.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
}
40
40
 
41
41
 
42
 
uint32_t calc_week(DRIZZLE_TIME *l_time, uint32_t week_behaviour, uint32_t *year)
 
42
uint32_t calc_week(type::Time *l_time, uint32_t week_behaviour, uint32_t *year)
43
43
{
44
44
  uint32_t days;
45
45
  uint32_t daynr= calc_daynr(l_time->year,l_time->month,l_time->day);
127
127
enum enum_drizzle_timestamp_type
128
128
str_to_datetime_with_warn(const char *str, 
129
129
                          uint32_t length, 
130
 
                          DRIZZLE_TIME *l_time,
 
130
                          type::Time *l_time,
131
131
                          uint32_t flags)
132
132
{
133
133
  int was_cut;
147
147
 
148
148
 
149
149
bool
150
 
str_to_time_with_warn(const char *str, uint32_t length, DRIZZLE_TIME *l_time)
 
150
str_to_time_with_warn(const char *str, uint32_t length, type::Time *l_time)
151
151
{
152
152
  int warning;
153
153
  bool ret_val= str_to_time(str, length, l_time, &warning);
158
158
}
159
159
 
160
160
 
161
 
void localtime_to_TIME(DRIZZLE_TIME *to, struct tm *from)
 
161
void localtime_to_TIME(type::Time *to, struct tm *from)
162
162
{
163
163
  to->neg=0;
164
164
  to->second_part=0;
170
170
  to->second=   (int) from->tm_sec;
171
171
}
172
172
 
173
 
void make_date(const DRIZZLE_TIME *l_time, String *str)
 
173
void make_time(const type::Time *l_time, String *str)
 
174
{
 
175
  str->alloc(MAX_DATE_STRING_REP_LENGTH);
 
176
  uint32_t length= (uint32_t) my_time_to_str(l_time, str->c_ptr());
 
177
  str->length(length);
 
178
  str->set_charset(&my_charset_bin);
 
179
}
 
180
 
 
181
void make_date(const type::Time *l_time, String *str)
174
182
{
175
183
  str->alloc(MAX_DATE_STRING_REP_LENGTH);
176
184
  uint32_t length= (uint32_t) my_date_to_str(l_time, str->c_ptr());
179
187
}
180
188
 
181
189
 
182
 
void make_datetime(const DRIZZLE_TIME *l_time, String *str)
 
190
void make_datetime(const type::Time *l_time, String *str)
183
191
{
184
192
  str->alloc(MAX_DATE_STRING_REP_LENGTH);
185
193
  uint32_t length= (uint32_t) my_datetime_to_str(l_time, str->c_ptr());
238
246
 
239
247
 
240
248
bool
241
 
calc_time_diff(DRIZZLE_TIME *l_time1, DRIZZLE_TIME *l_time2, int l_sign, int64_t *seconds_out,
 
249
calc_time_diff(type::Time *l_time1, type::Time *l_time2, int l_sign, int64_t *seconds_out,
242
250
               long *microseconds_out)
243
251
{
244
252
  long days;