~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/calendar.cc

  • Committer: Monty Taylor
  • Date: 2011-03-10 18:09:05 UTC
  • mfrom: (2225.2.2 refactor)
  • mto: This revision was merged to the branch mainline in revision 2228.
  • Revision ID: mordred@inaugust.com-20110310180905-ttx05t7q7ff6nl7c
Merge Olad: Refactoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 * Common functions for dealing with calendrical calculations
25
25
 */
26
26
 
27
 
#include "config.h"
 
27
#include <config.h>
28
28
 
29
29
#if TIME_WITH_SYS_TIME
30
30
# include <sys/time.h>
38
38
#endif
39
39
#include <cstdlib>
40
40
 
41
 
#include "drizzled/calendar.h"
 
41
#include <drizzled/calendar.h>
42
42
 
43
43
namespace drizzled
44
44
{
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 */