Package COM.INFORMATIMAGO.COMMON-LISP.CESARUM.DATE


Calendars, dates and times.

See also: COM.INFORMATIMAGO.COMMON-LISP.CESARUM.DATE
          COM.INFORMATIMAGO.COMMON-LISP.CESARUM.DATE.UTILITY
          COM.INFORMATIMAGO.COMMON-LISP.CESARUM.GREGORIAN-CALENDAR
          COM.INFORMATIMAGO.COMMON-LISP.CESARUM.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/>

*day*
variable
Symbolic duration of one day.
Initial value: 1 day
*duration-keywords*
variable
A list of keywords allowed in duration expressions,
in the order they should be printed.
Initial value: (YEAR MONTH WEEK DAY HOUR MINUTE SECONDE)
*hour*
variable
Symbolic duration of one hour.
Initial value: 1 hour
*minute*
variable
Symbolic duration of one minute.
Initial value: 1 minute
*month*
variable
Symbolic duration of one month.
Initial value: 1 month
*quarter*
variable
Symbolic duration of one quarter.
Initial value: 3 months
*seconde*
variable
Symbolic duration of one second.
Initial value: 1 seconde
*week*
variable
Symbolic duration of one week.
Initial value: 1 week
*year*
variable
Symbolic duration of one year.
Initial value: 1 year
+april+
constant
The number of the April month in the Gregorial calendar.
Initial value: 4
+august+
constant
The number of the August month in the Gregorial calendar.
Initial value: 8
+december+
constant
The number of the December month in the Gregorial calendar.
Initial value: 12
+february+
constant
The number of the February month in the Gregorial calendar.
Initial value: 2
+january+
constant
The number of the January month in the Gregorial calendar.
Initial value: 1
+july+
constant
The number of the July month in the Gregorial calendar.
Initial value: 7
+june+
constant
The number of the June month in the Gregorial calendar.
Initial value: 6
+march+
constant
The number of the Marchmonth in the Gregorial calendar.
Initial value: 3
+may+
constant
The number of the May month in the Gregorial calendar.
Initial value: 5
+november+
constant
The number of the November month in the Gregorial calendar.
Initial value: 11
+october+
constant
The number of the October month in the Gregorial calendar.
Initial value: 10
+september+
constant
The number of the September month in the Gregorial calendar.
Initial value: 9
(as-julian-date date)
generic-function
RETURN: The date converted to the Julian calendar.
(as-universal-time date)
generic-function
RETURN: The date converted to universal-time.
(date-after date duration)
generic-function
RETURN: The date DURATION after DATE.
(date-before date duration)
generic-function
RETURN: The date DURATION before DATE.
(date/= date1 date2)
generic-function
RETURN: Whether DATE1 is different from DATE2.
(date< date1 date2)
generic-function
RETURN: Whether DATE1 is before DATE2.
(date<= date1 date2)
generic-function
RETURN: Whether DATE1 is before or the same as DATE2.
(date= date1 date2)
generic-function
RETURN: Whether DATE1 is the same as DATE2.
(date> date1 date2)
generic-function
RETURN: Whether DATE1 is after DATE2.
(date>= date1 date2)
generic-function
RETURN: Whether DATE1 is after or the same as DATE2.
(day duration)
generic-function
RETURN: The day of the duration.
NOTE:   This is not the duration expressed in day, just the day
        component of the duration.
(decrement-day date &optional increment)
generic-function
DO: Changes the DATE to INCREMENT days before DATE.
duration
class
We store durations 'symbolically'. The 'units' may be colinear in a
given calendar, but we don't collapse them because either they may
be not colinear in other calendars, or their ratio may not be
always the same (eg. 1 year is 24 months in the Davian calendar vs
12 months in the Gregorian calendar, or 1 month may be 28, 29, 30
or 31 days).

There is no order for durations.

Moreover, the set of units is not hardwired, the client may add new
units to the *DURATION-KEYWORDS* list.  Only the units listed in
*DURATION-KEYWORDS* are processed by the DURATION arithmetic operators.

This allows us to use these DURATION objects with respect to any
calendar.
Class precedence list: DURATION STANDARD-OBJECT T
(duration &rest expression &key &allow-other-keys)
function
RETURN:  A new DURATION instance, initialized with the EXPRESSION.
NOTE:    Only the keywords listed in *DURATION-KEYWORDS* are really allowed.
(duration* a n)
generic-function
RETURN: The product of a duration by a number.
(duration+ a b)
generic-function
RETURN: The sum of two durations.
(duration- a b)
generic-function
RETURN: The difference of two durations.
(duration-between end start)
generic-function
Return the DURATION between END and START.
Both END and START dates must be of the same class.
(gregorian &key year month day hour minute seconde timezone universal-time)
function
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.
gregorian-calendar-date
class
A date in the Gregorian calendar.
Class precedence list: GREGORIAN-CALENDAR-DATE STANDARD-OBJECT T
Class init args: YEAR MONTH DAY HOUR MINUTE SECONDE TIMEZONE
(hour duration)
generic-function
RETURN: The hour of the duration.
NOTE:   This is not the duration expressed in hour, just the hour
        component of the duration.
(increment-day date &optional increment)
generic-function
DO: Changes the DATE to INCREMENT days after DATE.
(minute duration)
generic-function
RETURN: The minute of the duration.
NOTE:   This is not the duration expressed in minute, just the minute
        component of the duration.
(month duration)
generic-function
RETURN: The month of the duration.
NOTE:   This is not the duration expressed in month, just the month
        component of the duration.
(next-day date &optional increment)
generic-function
RETURN: A new date that is INCREMENT days after DATE.
(previous-day date &optional increment)
generic-function
RETURN: A new date that is INCREMENT days before DATE.
(seconde duration)
generic-function
RETURN: The seconde of the duration.
NOTE:   This is not the duration expressed in seconde, just the seconde
        component of the duration.
(timezone date)
generic-function
RETURN: The timezone of a date
        = number of seconds from Greenwich; East positive.
(to-timezone date timezone)
generic-function
RETURN: A new date equal to the DATE, but in the given TIMEZONE.
(week duration)
generic-function
RETURN: The week of the duration.
NOTE:   This is not the duration expressed in week, just the week
        component of the duration.
(weekday date)
generic-function
RETURN: The weekday of a date.
(year duration)
generic-function
RETURN: The year of the duration.
NOTE:   This is not the duration expressed in year, just the year
        component of the duration.