~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/time.cc

  • Committer: Monty Taylor
  • Date: 2009-03-05 02:06:48 UTC
  • mfrom: (907.1.8 trunk-with-temporal)
  • mto: This revision was merged to the branch mainline in revision 912.
  • Revision ID: mordred@inaugust.com-20090305020648-7jk1gie4lqsi22g8
Merged from Jay.

Show diffs side-by-side

added added

removed removed

Lines of Context:
212
212
  return ts_type;
213
213
}
214
214
 
215
 
 
216
 
/*
217
 
  Convert a datetime from broken-down DRIZZLE_TIME representation to corresponding
218
 
  TIMESTAMP value.
219
 
 
220
 
  SYNOPSIS
221
 
    TIME_to_timestamp()
222
 
      session             - current thread
223
 
      t               - datetime in broken-down representation,
224
 
      in_dst_time_gap - pointer to bool which is set to true if t represents
225
 
                        value which doesn't exists (falls into the spring
226
 
                        time-gap) or to false otherwise.
227
 
 
228
 
  RETURN
229
 
     Number seconds in UTC since start of Unix Epoch corresponding to t.
230
 
     0 - t contains datetime value which is out of TIMESTAMP range.
231
 
 
232
 
*/
233
 
time_t TIME_to_timestamp(Session *session, const DRIZZLE_TIME *t,
234
 
                            bool *in_dst_time_gap)
235
 
{
236
 
  time_t timestamp;
237
 
 
238
 
  *in_dst_time_gap= 0;
239
 
 
240
 
  timestamp= session->variables.time_zone->TIME_to_gmt_sec(t, in_dst_time_gap);
241
 
  if (timestamp)
242
 
  {
243
 
    return timestamp;
244
 
  }
245
 
 
246
 
  /* If we are here we have range error. */
247
 
  return(0);
248
 
}
249
 
 
250
 
 
251
215
/*
252
216
  Convert a time string to a DRIZZLE_TIME struct and produce a warning
253
217
  if string was cut during conversion.