~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/type/time.cc

  • Committer: Brian Aker
  • Date: 2011-01-13 00:08:59 UTC
  • mto: (2082.4.1 timestamp)
  • mto: This revision was merged to the branch mainline in revision 2098.
  • Revision ID: brian@tangent.org-20110113000859-8dw4ybnp8id56u50
Fix issue with return value from unix_timestamp(). Also clean up error
messages, and remove limit on value for timestamp.

Show diffs side-by-side

added added

removed removed

Lines of Context:
886
886
    We are safe with shifts close to MAX_INT32, as there are no known
887
887
    time switches on Jan 2038 yet :)
888
888
  */
889
 
  if ((t->year == TIMESTAMP_MAX_YEAR) && (t->month == 1) && (t->day > 4))
890
 
  {
891
 
    /*
892
 
      Below we will pass (uint32_t) (t->day - shift) to calc_daynr.
893
 
      As we don't want to get an overflow here, we will shift
894
 
      only safe dates. That's why we have (t->day > 4) above.
895
 
    */
896
 
    t->day-= 2;
897
 
    shift= 2;
898
 
  }
899
889
#ifdef TIME_T_UNSIGNED
900
 
  else
901
890
  {
902
891
    /*
903
892
      We can get 0 in time_t representaion only on 1969, 31 of Dec or on
1272
1261
 
1273
1262
static uint64_t TIME_to_uint64_t_date(const type::Time *my_time)
1274
1263
{
1275
 
  return (uint64_t) (my_time->year * 10000UL + my_time->month * 100UL +
1276
 
                      my_time->day);
 
1264
  return (uint64_t) (my_time->year * 10000UL +
 
1265
                     my_time->month * 100UL +
 
1266
                     my_time->day);
1277
1267
}
1278
1268
 
1279
1269
 
1286
1276
static uint64_t TIME_to_uint64_t_time(const type::Time *my_time)
1287
1277
{
1288
1278
  return (uint64_t) (my_time->hour * 10000UL +
1289
 
                      my_time->minute * 100UL +
1290
 
                      my_time->second);
 
1279
                     my_time->minute * 100UL +
 
1280
                     my_time->second);
1291
1281
}
1292
1282
 
1293
1283