~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/calendar.cc

  • Committer: Barry.Leslie at PrimeBase
  • Date: 2011-01-22 03:22:44 UTC
  • mfrom: (2101 staging)
  • mto: (2228.1.4 build)
  • mto: This revision was merged to the branch mainline in revision 2230.
  • Revision ID: barry.leslie@primebase.com-20110122032244-ukbe3mlj7fs8xph6
Merged with lp:drizzle.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
 
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
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
343
  if (month == 0 || day == 0)
344
344
    return false;
 
345
 
345
346
  if (year < UNIX_EPOCH_MAX_YEARS
346
347
      && year >= UNIX_EPOCH_MIN_YEARS)
347
348
    return true;
 
349
 
348
350
  if (year < UNIX_EPOCH_MIN_YEARS)
349
351
    return false;
 
352
 
350
353
  if (year == UNIX_EPOCH_MAX_YEARS)
351
354
  {
352
355
    if (month > 1)
 
356
    {
353
357
      return false;
 
358
    }
354
359
    if (day > 19)
 
360
    {
355
361
      return false;
 
362
    }
356
363
    else if (day < 19)
 
364
    {
357
365
      return true;
 
366
    }
358
367
    else
359
368
    {
360
369
      /* We are on the final day of UNIX Epoch */