Common Lisp Package: COM.INFORMATIMAGO.COMMON-LISP.GREGORIAN-CALENDAR

Defines the Gregorian calendar. See also: COM.INFORMATIMAGO.COMMON-LISP.CESARUM.DATE COM.INFORMATIMAGO.COMMON-LISP.CESARUM.DATE.UTILITY COM.INFORMATIMAGO.COMMON-LISP.JULIAN-CALENDAR License: AGPL3 Copyright Pascal J. Bourguignon 2007 - 2012 This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>

README:

FUNCTION

Public

DATE-FROM-DAY-NUMBER (DAY-NUMBER)

RETURN: the gregorian-date of the given DAY-NUMBER.

DATE-TO-DAY-NUMBER (DAY MONTH YEAR)

RETURN: the day number of the gregorian-date given by DAY, MONTH and YEAR.

GREGORIAN (&KEY (YEAR 1582 YEARP) (MONTH +OCTOBER+ MONTHP) (DAY 15 DAYP) (HOUR 0 HOURP) (MINUTE 0 MINUTEP) (SECONDE 0 SECONDEP) (TIMEZONE NIL) (UNIVERSAL-TIME NIL))

RETURN: A new Gregorian date. YEAR: The year (historically, should be greater or equal to 1582). MONTH: The month. DAY: The day. HOUR: The hour. MINUTE: The minute. SECONDE: The second. TIMEZONE: The timezone. UNIVERSAL-TIME: The date expressed in universal-time. NOTE: UNIVERSAL-TIME when present gives a base date with default values for the other fields.

LEAP-YEAR-P (YEAR)

RETURN: Whether YEAR is a gregorian leap year.

Private

Undocumented

CHECK-DAY-NUMBER (&KEY TRACE-DAY PRINT-ALL (START 0) (END +DAYS-IN-FOURCENTURY+))

DAYS-IN-MONTH (YEAR MONTH)

DAYS-IN-YEAR (YEAR)

GENERIC-FUNCTION

Public

AS-JULIAN-DATE (DATE)

RETURN: The date converted to the Julian calendar.

AS-LIST-OF-NUMBERS (DATE)

Return the values of the date from the most significant number to the last. It can be a list of a single number. This is meaningful only in the context of the given date class, and used to compare two dates of the same class.

AS-UNIVERSAL-TIME (DATE)

RETURN: The date converted to universal-time.

DATE-AFTER (DATE DURATION)

RETURN: The date DURATION after DATE.

DATE-BEFORE (DATE DURATION)

RETURN: The date DURATION before DATE.

DECREMENT-DAY (DATE &OPTIONAL INCREMENT)

DO: Changes the DATE to INCREMENT days before DATE.

DURATION-BETWEEN (END START)

Return the DURATION between END and START. Both END and START dates must be of the same class.

INCREMENT-DAY (DATE &OPTIONAL INCREMENT)

DO: Changes the DATE to INCREMENT days after DATE.

NEXT-DAY (DATE &OPTIONAL INCREMENT)

RETURN: A new date that is INCREMENT days after DATE.

PREVIOUS-DAY (DATE &OPTIONAL INCREMENT)

RETURN: A new date that is INCREMENT days before DATE.

TO-TIMEZONE (DATE TIMEZONE)

RETURN: A new date equal to the DATE, but in the given TIMEZONE.

WEEK (DURATION)

RETURN: The week of the duration. NOTE: This is not the duration expressed in week, just the week component of the duration.

WEEKDAY (DATE)

RETURN: The weekday of a date.

Undocumented

SETFWEEK (VALUE SELF)

Private

Undocumented

UNITS-OF-LIST-OF-NUMBERS (SELF)

SLOT-ACCESSOR

Public

DAY (DURATION)

The RETURN: The day of the duration. NOTE: This is not the duration expressed in day, just the day component of the duration.

SETFDAY (VALUE SELF)

Set the RETURN: The day of the duration. NOTE: This is not the duration expressed in day, just the day component of the duration.

HOUR (DURATION)

The RETURN: The hour of the duration. NOTE: This is not the duration expressed in hour, just the hour component of the duration.

SETFHOUR (VALUE SELF)

Set the RETURN: The hour of the duration. NOTE: This is not the duration expressed in hour, just the hour component of the duration.

MINUTE (DURATION)

The RETURN: The minute of the duration. NOTE: This is not the duration expressed in minute, just the minute component of the duration.

SETFMINUTE (VALUE SELF)

Set the RETURN: The minute of the duration. NOTE: This is not the duration expressed in minute, just the minute component of the duration.

MONTH (DURATION)

The RETURN: The month of the duration. NOTE: This is not the duration expressed in month, just the month component of the duration.

SETFMONTH (VALUE SELF)

Set the RETURN: The month of the duration. NOTE: This is not the duration expressed in month, just the month component of the duration.

SECONDE (DURATION)

The RETURN: The seconde of the duration. NOTE: This is not the duration expressed in seconde, just the seconde component of the duration.

SETFSECONDE (VALUE SELF)

Set the RETURN: The seconde of the duration. NOTE: This is not the duration expressed in seconde, just the seconde component of the duration.

TIMEZONE (DATE)

The RETURN: The timezone of a date = number of seconds from Greenwich; East positive.

SETFTIMEZONE (NEW-VALUE OBJECT)

Set the RETURN: The timezone of a date = number of seconds from Greenwich; East positive.

YEAR (DURATION)

The RETURN: The year of the duration. NOTE: This is not the duration expressed in year, just the year component of the duration.

SETFYEAR (VALUE SELF)

Set the RETURN: The year of the duration. NOTE: This is not the duration expressed in year, just the year component of the duration.

CLASS

Public

GREGORIAN-CALENDAR-DATE

A date in the Gregorian calendar.

CONSTANT

Public

+APRIL+

The number of the April month in the Gregorial calendar.

+AUGUST+

The number of the August month in the Gregorial calendar.

+DECEMBER+

The number of the December month in the Gregorial calendar.

+FEBRUARY+

The number of the February month in the Gregorial calendar.

+JANUARY+

The number of the January month in the Gregorial calendar.

+JULY+

The number of the July month in the Gregorial calendar.

+JUNE+

The number of the June month in the Gregorial calendar.

+MARCH+

The number of the Marchmonth in the Gregorial calendar.

+MAY+

The number of the May month in the Gregorial calendar.

+NOVEMBER+

The number of the November month in the Gregorial calendar.

+OCTOBER+

The number of the October month in the Gregorial calendar.

+SEPTEMBER+

The number of the September month in the Gregorial calendar.

Private

+DAYS-IN-FOURCENTURY+

Number of days in 400 gregorian years: 96 groups of 4 years including 3 flat years and one leap year + 3 groups of four flat years, multiple of 100 not multiple of 400 + 1 group of 4 years including 3 flat years and one leap year, multiple of 400.

Undocumented

+1964-03-15-DAY-NUMBER+

+DAYS-IN-FOURYEARS+