drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
calendar.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  drizzled
 TODO: Rename this file - func.h is stupid.

Macros

#define JULIAN_DAY_NUMBER_AT_ABSOLUTE_DAY_ONE   INT64_C(1721425)
#define DAYS_IN_NORMAL_YEAR   INT32_C(365)
#define DAYS_IN_LEAP_YEAR   INT32_C(366)
#define UNIX_EPOCH_MIN_YEARS   1970
#define UNIX_EPOCH_MAX_YEARS   2038
#define CALENDAR_YY_PART_YEAR   70
#define GREGORIAN_DAYS_IN_400_YEARS   UINT32_C(146097)
#define GREGORIAN_DAYS_IN_100_YEARS   UINT32_C(36524)
#define GREGORIAN_DAYS_IN_4_YEARS   UINT32_C(1461)

Enumerations

enum  drizzled::calendar { GREGORIAN = 1 , JULIAN = 2 , HEBREW = 3 , ISLAM = 4 }

Functions

int64_t drizzled::julian_day_number_from_gregorian_date (uint32_t year, uint32_t month, uint32_t day)
int64_t drizzled::absolute_day_number_to_julian_day_number (int64_t absolute_day)
int64_t drizzled::julian_day_number_to_absolute_day_number (int64_t julian_day)
void drizzled::gregorian_date_from_julian_day_number (int64_t julian_day, uint32_t *year_out, uint32_t *month_out, uint32_t *day_out)
void drizzled::gregorian_date_from_absolute_day_number (int64_t absolute_day, uint32_t *year_out, uint32_t *month_out, uint32_t *day_out)
uint32_t drizzled::days_in_year (uint32_t year, enum calendar calendar)
uint32_t drizzled::days_in_year_gregorian (const uint32_t year)
uint32_t drizzled::days_in_year_julian (const uint32_t year)
int32_t drizzled::number_of_leap_years_julian (uint32_t year)
int32_t drizzled::number_of_leap_years_gregorian (uint32_t year)
uint32_t drizzled::days_in_gregorian_year_month (uint32_t year, uint32_t month)
static bool drizzled::num_leap_years (uint32_t y, enum calendar c)
uint32_t drizzled::day_of_week (int64_t day_number, bool sunday_is_first_day_of_week)
bool drizzled::is_valid_gregorian_date (uint32_t year, uint32_t month, uint32_t day)
bool drizzled::in_unix_epoch_range (uint32_t year, uint32_t month, uint32_t day, uint32_t hour, uint32_t minute, uint32_t second)
uint32_t drizzled::week_number_from_gregorian_date (uint32_t year, uint32_t month, uint32_t day, bool sunday_is_first_day_of_week)
uint32_t drizzled::iso_week_number_from_gregorian_date (uint32_t year, uint32_t month, uint32_t day)
uint32_t drizzled::year_month_to_months (uint32_t year_month)
uint32_t drizzled::months_to_year_month (uint32_t months)
static bool drizzled::is_leap_year (uint32_t y, enum calendar c)
static bool drizzled::is_gregorian_leap_year (uint32_t y)
static bool drizzled::is_julian_leap_year (uint32_t y)

Detailed Description

Structures and functions for:

Calculating day number in Gregorian and Julian proleptic calendars. Converting between day numbers and dates in the calendars. Converting between different calendars. Calculating differences between dates.

Works used in research:

[Calendrical] Calculations", Dershowitz and Reingold [ISO] 8601 http://en.wikipedia.org/wiki/ISO_8601 [http://www.ddj.com/hpc-high-performance-computing/197006254] [http://en.wikipedia.org/wiki/Julian_day]#Calculation

Definition in file calendar.h.

Macro Definition Documentation

◆ CALENDAR_YY_PART_YEAR

#define CALENDAR_YY_PART_YEAR   70

Definition at line 49 of file calendar.h.

◆ DAYS_IN_LEAP_YEAR

#define DAYS_IN_LEAP_YEAR   INT32_C(366)

Definition at line 44 of file calendar.h.

◆ DAYS_IN_NORMAL_YEAR

#define DAYS_IN_NORMAL_YEAR   INT32_C(365)

Definition at line 43 of file calendar.h.

◆ GREGORIAN_DAYS_IN_100_YEARS

#define GREGORIAN_DAYS_IN_100_YEARS   UINT32_C(36524)

Definition at line 62 of file calendar.h.

◆ GREGORIAN_DAYS_IN_400_YEARS

#define GREGORIAN_DAYS_IN_400_YEARS   UINT32_C(146097)

The following constants define the system of calculating the number of days in various periods of time in the Gregorian calendar.

Leap years (years containing 366 days) occur:

  • When the year is evenly divisible by 4
  • If the year is evenly divisible by 100, it must also be evenly divisible by 400.

Definition at line 61 of file calendar.h.

◆ GREGORIAN_DAYS_IN_4_YEARS

#define GREGORIAN_DAYS_IN_4_YEARS   UINT32_C(1461)

Definition at line 63 of file calendar.h.

◆ JULIAN_DAY_NUMBER_AT_ABSOLUTE_DAY_ONE

#define JULIAN_DAY_NUMBER_AT_ABSOLUTE_DAY_ONE   INT64_C(1721425)

Definition at line 41 of file calendar.h.

◆ UNIX_EPOCH_MAX_YEARS

#define UNIX_EPOCH_MAX_YEARS   2038

Definition at line 47 of file calendar.h.

◆ UNIX_EPOCH_MIN_YEARS

#define UNIX_EPOCH_MIN_YEARS   1970

Definition at line 46 of file calendar.h.