Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the periods Reference Manual, version 0.0.2, generated automatically by Declt version 3.0 "Montgomery Scott" on Tue Dec 22 14:38:11 2020 GMT+0.
• Introduction | What periods is all about | |
• Systems | The systems documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
Welcome to the PERIODS library. The intention of this code is to provide a convenient set of utilities for manipulating times, distances between times, and both contiguous and discontiguous ranges of time. By combining these facilities in various ways, almost any type of time expression is possible. Please see the documentation in doc/ for information. John Wiegley
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The periods system |
Christophe Junke <junke.christophe@gmail.com>
Johh Wiegley <jwiegley@gmail.com>
BSD-3
Utilities for manipulating time ranges and distances, based on LOCAL-TIME.
0.0.2
local-time
periods.asd (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
• The periods.asd file | ||
• The periods/periods.lisp file | ||
• The periods/strptime.lisp file | ||
• The periods/parser.lisp file |
Next: The periods/periods․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
periods.asd
periods (system)
Next: The periods/strptime․lisp file, Previous: The periods․asd file, Up: Lisp files [Contents][Index]
periods (system)
periods.lisp
Next: The periods/parser․lisp file, Previous: The periods/periods․lisp file, Up: Lisp files [Contents][Index]
periods.lisp (file)
periods (system)
strptime.lisp
read-integer (function)
Previous: The periods/strptime․lisp file, Up: Lisp files [Contents][Index]
strptime.lisp (file)
periods (system)
parser.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The periods package |
periods.lisp (file)
time-periods
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported special variables | ||
• Exported macros | ||
• Exported functions | ||
• Exported structures | ||
• Exported types |
Next: Exported macros, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
periods.lisp (file)
periods.lisp (file)
Next: Exported functions, Previous: Exported special variables, Up: Exported definitions [Contents][Index]
Define a context where (1) MIN-SYMBOL and MAX-SYMBOL are locally
bound variables with NIL default values and (2) UPDATE names a
lexically bound function which takes a timestamp and updates the
variables MIN-SYMBOL and MAX-SYMBOL so that they respectively hold the
earliest and latest timestamp after successive invocations. That
function finally returns its input value. For example, the following
code builds a TIME-RANGE instance from a list of dated transactions.
(with-timestamp-range (earliest latest)
(dolist (tt transaction)
(update-range (transaction-date tt)))
(time-range :begin earliest :end latest :end-inclusive-p t))
A custom name can be used to nest invocations:
(with-timestamp-range (earliest latest global-update-range)
(dolist (jj journals)
(with-timestamp-range (<< >>)
(dolist (tt (journal-xact jj))
(gloal-update-range
(update-range (transaction-date tt))))
(format t "Journal earliest / latest: ~A / ~A~%" << >>)))
(format t "Global earliest / latest: ~A / ~A~%" earliest latest))
periods.lisp (file)
Next: Exported structures, Previous: Exported macros, Up: Exported definitions [Contents][Index]
Add one duration to another.
periods.lisp (file)
Given a FIXED-TIME, add the supplied DURATION.
Example (reader notation requires calling LOCAL-TIME:ENABLE-READ-MACROS):
(add-time @2007-05-20T12:10:10.000 (duration :hours 50))
=> @2007-05-22T14:10:10.000
NOTE: This function always adds the largest increments first, so:
(add-time @2003-01-09 (duration :years 1 :days 20)) => @2004-02-29
If days has been added before years, the result would have been "@2004-03-01".
periods.lisp (file)
Return the current year as a FIXNUM.
periods.lisp (file)
Return the day of the week associated with a given FIXED-TIME.
The result is a FIXNUM with 0 representing Sunday, through 6 on Saturday.
periods.lisp (file)
Create a DURATION object.
One thing to note about duration: there is no way to determine the total length of a duration in terms of any specific time quantity, without first binding that duration to a fixed point in time (after all, how many days are in a month if you don’t know which month it is?) Therefore, those looking for a function like "duration-seconds" are really wanting to work with ranges, not just durations.
periods.lisp (file)
periods.lisp (file)
Return T if the given FIXED-TIME occurs on a Saturday or Sunday.
periods.lisp (file)
Examine the property list STEP-BY and return the smallest unit of time
specified.
For example, given the following property list:
(:DAY 10 :HOUR 5 :MINUTE 2)
The result is :MINUTE.
periods.lisp (file)
Return a fixed point in time relative to the time of the call. ARGS is a
property list giving a specific precision for the return value.
If the keyword argument :NOW is given, all else is ignored; this is
equivalent to calling LOCAL-TIME:NOW.
Otherwise, any keyword arguments given override their corresponding elements in the current time. Further, any elements smaller in resolution than the finest specified element are reduced to 0 or 1, according to their position.
For example, assuming the current time is "@2007-11-17T23:02:00.000",
compare these outputs:
(fixed-time :month 4) => @2007-04-01T00:00:00.000
(fixed-time :day 10) => @2007-11-10T00:00:00.000
(fixed-time :hour 15) => @2007-11-17T15:00:00.000
This behavior makes it very easy to return a fixed time for "april of this year", etc. If you wish to determine the date of the previous April, while preserving the current day of the month, hour of the day, etc., then see the function PREVIOUS-TIME.
periods.lisp (file)
Reduce a fixed time to be no finer than RESOLUTION.
For example, if the date is 2007-04-20, and the resolution is :month, the date is floored to 2007-04-01. Anything smaller than the resolution is reduced to zero (or 1, if it is a day or month being reduced).
periods.lisp (file)
Return T if YEAR falls on a leap year.
periods.lisp (file)
parser.lisp (file)
parser.lisp (file)
strptime.lisp (file)
periods.lisp (file)
strptime.lisp (file)
strptime.lisp (file)
strptime.lisp (file)
Subtract one duration from another.
periods.lisp (file)
periods.lisp (file)
Compute the duration existing between fixed-times LEFT and RIGHT.
The order of left or right is ignored; the returned DURATION, if added to
the earlier value, will result in the later.
A complexity of this process which might surprise some is that larger quantities are added by ADD-TIME before smaller quantities. For example, what is the difference between 2003-02-10 and 2004-03-01? If you add years before days, the difference is 1 year and 20 days. If you were to add days before years, however, the difference would be 1 year and 21 days. The question, do you advance to 2004 and then calculate between 2-10 and 3-01, or do you move from 2-10 to 3-01, and then increment the year? This library chooses to add years before days, since this follows human reckoning a bit closer (i.e., a person would likely flip to the 2004 calendar and then start counting off days, rather than the other way around). This difference in reckoning can be tricky, however, so bear this in mind.
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
(setf time-range-begin) (setf expander)
periods.lisp (file)
time-range-begin (function)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
Next: Exported types, Previous: Exported functions, Up: Exported definitions [Contents][Index]
periods.lisp (file)
structure-object (structure)
integer
0
duration-years (function)
(setf duration-years) (function)
integer
0
duration-months (function)
(setf duration-months) (function)
integer
0
duration-days (function)
(setf duration-days) (function)
integer
0
duration-hours (function)
(setf duration-hours) (function)
integer
0
duration-minutes (function)
(setf duration-minutes) (function)
integer
0
duration-seconds (function)
(setf duration-seconds) (function)
integer
0
duration-milliseconds (function)
(setf duration-milliseconds) (function)
integer
0
duration-microseconds (function)
(setf duration-microseconds) (function)
integer
0
duration-nanoseconds (function)
(setf duration-nanoseconds) (function)
periods.lisp (file)
structure-object (structure)
time-period-range (function)
(setf time-period-range) (function)
time-period-step (function)
(setf time-period-step) (function)
time-period-skip (function)
(setf time-period-skip) (function)
periods.lisp (file)
structure-object (structure)
get-range-fixed-begin (function)
(setf get-range-fixed-begin) (function)
get-range-begin (function)
(setf get-range-begin) (function)
t
get-range-begin-inclusive-p (function)
(setf get-range-begin-inclusive-p) (function)
get-range-fixed-end (function)
(setf get-range-fixed-end) (function)
get-range-end (function)
(setf get-range-end) (function)
get-range-end-inclusive-p (function)
(setf get-range-end-inclusive-p) (function)
get-range-duration (function)
(setf get-range-duration) (function)
get-range-anchor (function)
(setf get-range-anchor) (function)
Previous: Exported structures, Up: Exported definitions [Contents][Index]
periods.lisp (file)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal special variables | ||
• Internal macros | ||
• Internal functions | ||
• Internal structures |
Next: Internal macros, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
periods.lisp (file)
parser.lisp (file)
parser.lisp (file)
Next: Internal functions, Previous: Internal special variables, Up: Internal definitions [Contents][Index]
A ’do’ style version of the functional MAP-RELATIVE-TIMES macro.
The disadvantage to DO-RELATIVE-TIMES is that there is no way to ask for a reversed time sequence, or specify an inclusive endpoint.
periods.lisp (file)
periods.lisp (file)
A ’do’ style version of the functional MAP-TIMES macro.
The disadvantage to DO-TIMES is that there is no way to ask for a reversed time sequence, or specify an inclusive endpoint.
periods.lisp (file)
parser.lisp (file)
Return a list of all times within the given range.
periods.lisp (file)
periods.lisp (file)
Return a list of all times within the given range.
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
Map over a set of times separated by DURATION, calling CALLABLE with the start of each.
periods.lisp (file)
Map over a set of times separated by DURATION, calling CALLABLE with the start of each.
periods.lisp (file)
periods.lisp (file)
Map over a set of times separated by DURATION, calling CALLABLE with the start of each.
periods.lisp (file)
periods.lisp (file)
Next: Internal structures, Previous: Internal macros, Up: Internal definitions [Contents][Index]
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
A bounded addition operator. Returns: VALUE CARRY.
periods.lisp (file)
A bounded subtraction operator. Returns: VALUE CARRY.
periods.lisp (file)
parser.lisp (file)
parser.lisp (file)
parser.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
Return T if the given time elements honor the details in RELATIVE-TIME.
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
Return a DURATION which, if applied to a time, causes NEXT-TIME to move to
the next matching occurrence of that time pattern.
For example, if you ask for ’:day 18’ on Nov 18, it will return the same time back to you. If you add enclosing duration for that relative time to Nov 18 and then ask again, you’ll get Dec 18.
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
parser.lisp (file)
periods.lisp (file)
parser.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
Return T if the given FIXED-TIME honors the details in RELATIVE-TIME.
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
Add one duration to another.
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
Compute the first time after FIXED-TIME which matches RELATIVE-TIME.
This function finds the first moment after FIXED-TIME which honors every
element in RELATIVE-TIME:
(next-time @2007-05-20 (relative-time :month 3)) => @2008-03-20
The relative time constructor arguments may also be symbolic:
(relative-time :month :this)
(relative-time :month :next)
(relative-time :month :prev)
To find the date two weeks after next February, a combination of NEXT-TIME
and ADD-TIME must be used, since "next February" is a relative time concept,
while "two weeks" is a duration concept:
(add-time (next-time @2007-05-20 (relative-time :month 2))
(duration :days 14))
NOTE: The keyword arguments to RELATIVE-TIME are always singular; those to
DURATION are always plural.
The following form resolves to the first sunday of the given year:
(next-time (previous-time @2007-05-20
(relative-time :month 1 :day 1))
(relative-time :week-day 0))
This form finds the first Friday the 13th after today:
(next-time @2007-05-20 (relative-time :day 13 :day-of-week 5))
NOTE: When adding times, NEXT-TIME always seeks the next time that fully
honors your request. If asked for Feb 29, the year of the resulting time will
fall in a leap year. If asked for Thu, Apr 29, it returns the next occurrence
of Apr 29 which falls on a Friday. Example:
(next-time @2007-11-01
(relative-time :month 4 :day 29 :day-of-week 4))
=> @2010-04-29T00:00:00.000
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
parser.lisp (file)
parser.lisp (file)
parser.lisp (file)
parser.lisp (file)
parser.lisp (file)
parser.lisp (file)
parser.lisp (file)
parser.lisp (file)
parser.lisp (file)
parser.lisp (file)
parser.lisp (file)
parser.lisp (file)
parser.lisp (file)
parser.lisp (file)
parser.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
This function is the reverse of ‘NEXT-TIME’. Please look there for more.
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
parser.lisp (file)
strptime.lisp (file)
parser.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
parser.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
parser.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
periods.lisp (file)
Previous: Internal functions, Up: Internal definitions [Contents][Index]
periods.lisp (file)
structure-object (structure)
(or keyword integer null)
relative-time-year (function)
(setf relative-time-year) (function)
(or keyword integer null)
relative-time-month (function)
(setf relative-time-month) (function)
(or keyword integer null)
relative-time-week (function)
(setf relative-time-week) (function)
(or keyword integer null)
relative-time-day-of-week (function)
(setf relative-time-day-of-week) (function)
(or keyword integer null)
relative-time-day (function)
(setf relative-time-day) (function)
(or keyword integer null)
relative-time-hour (function)
(setf relative-time-hour) (function)
(or keyword integer null)
relative-time-minute (function)
(setf relative-time-minute) (function)
(or keyword integer null)
relative-time-second (function)
(setf relative-time-second) (function)
(or keyword integer null)
relative-time-millisecond (function)
(setf relative-time-millisecond) (function)
(or keyword integer null)
relative-time-microsecond (function)
(setf relative-time-microsecond) (function)
(or keyword integer null)
relative-time-nanosecond (function)
(setf relative-time-nanosecond) (function)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | F L P |
---|
Jump to: | F L P |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | (
A B C D E F G H I L M N P R S T U W Y |
---|
Jump to: | (
A B C D E F G H I L M N P R S T U W Y |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | *
A B D E F H M N R S W Y |
---|
Jump to: | *
A B D E F H M N R S W Y |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | D F P R S T |
---|
Jump to: | D F P R S T |
---|