~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/calendar.cc

  • Committer: Brian Aker
  • Date: 2011-01-19 18:03:32 UTC
  • mfrom: (2088.8.12 timestamp)
  • mto: This revision was merged to the branch mainline in revision 2098.
  • Revision ID: brian@tangent.org-20110119180332-acfk5i8oofp63s40
Merge in time code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
333
333
 * @param Minute
334
334
 * @param Second
335
335
 */
336
 
bool in_unix_epoch_range(uint32_t year
337
 
                       , uint32_t month
338
 
                       , uint32_t day
339
 
                       , uint32_t hour
340
 
                       , uint32_t minute
341
 
                       , uint32_t second)
 
336
bool in_unix_epoch_range(uint32_t year,
 
337
                         uint32_t month,
 
338
                         uint32_t day,
 
339
                         uint32_t hour,
 
340
                         uint32_t minute,
 
341
                         uint32_t second)
342
342
{
 
343
  (void)hour;
 
344
  (void)minute;
 
345
  (void)second;
 
346
 
343
347
  if (month == 0 || day == 0)
344
348
    return false;
345
 
  if (year < UNIX_EPOCH_MAX_YEARS
346
 
      && year >= UNIX_EPOCH_MIN_YEARS)
347
 
    return true;
 
349
 
348
350
  if (year < UNIX_EPOCH_MIN_YEARS)
349
351
    return false;
350
 
  if (year == UNIX_EPOCH_MAX_YEARS)
351
 
  {
352
 
    if (month > 1)
353
 
      return false;
354
 
    if (day > 19)
355
 
      return false;
356
 
    else if (day < 19)
357
 
      return true;
358
 
    else
359
 
    {
360
 
      /* We are on the final day of UNIX Epoch */
361
 
      uint32_t seconds= (hour * 60 * 60)
362
 
                      + (minute * 60)
363
 
                      + (second);
364
 
      if (seconds <= ((3 * 60 * 60) + (14 * 60) + 7))
365
 
        return true;
366
 
      return false;
367
 
    }
368
 
  }
369
 
  return false;
 
352
 
 
353
  return true;
370
354
}
371
355
 
372
356
/**