Generated: Sunday, December 4, 2005, 22:41:14 A SchemeDoc Manual

My Manual

My Name My affiliation

Source file: /user/normark/scheme/lib/time.scm

Some abstract. As an example we extract interface documention from the LAML time library. We use the CSS style for this manual.

Table of Contents:
1. Time zone and Daylight Saving Time correction. 4. Week days. 7. Time interval functions.
2. Basic time functions. 5. Week number and week day number. 8. Conventional string representation of time.
3. Time selectors. 6. Time pretty printing. 9. Underlying time related constants and functions.

Alphabetic index:
brief-weekday (brief-weekday second-count) Given an integer, second-count, return the weekday as a brief string, of the time second-count.
danish-week-number (danish-week-number sc) Given a number sc, return the week number in which sc i located.
date-ok? (date-ok? x) Return whether x is a legal date string (of the form "ddmmyyyy") Exact determination, including february and leap years.
date-string (date-string second-count) Return the date, in the format "ddmmyyyy" of second-count, which represents the time in seconds elapsed since January 1, 1970.
date-time (date-time second-count) Given an integer, second-cound, return a list of two strings: (date time).
date-time-one-string (date-time-one-string second-count) Return a single string that pretty prints the time represented by second count.
day-of-time (day-of-time decoded-time-list) Return the days of a decoded time list.
days-in-month (days-in-month month year) Return the number of days in month and year
get-month-name (get-month-name month-number) Return the month name of month-number.
hour-of-time (hour-of-time decoded-time-list) Return the hour of a decoded time list.
hours-minutes-decode-string (hours-minutes-decode-string hour-minute-string) Decode a string of the form "h:m" or "h.m" to a list of the form (h m).
hours-minutes-seconds-decode (hours-minutes-seconds-decode second-count) Return a list of (hours minutues seconds) given an integer second-count.
leap-year (leap-year y) Return whether y is a leap year.
minute-of-time (minute-of-time decoded-time-list) Return the minutes of a decoded time list.
month-of-time (month-of-time decoded-time-list) Return the month of a decoded time list.
present-time-interval (present-time-interval second-count) Return a string which presens the number of years, months, weeks, days, hours, minutes, and seconds of second-count
second-count (second-count y mo d h mi s) Given date and time in terms of year y, month mo, day d, hour h, minutes mi, and seconds s, caluculate the second count.
second-of-time (seconds-of-time decoded-time-list) Return the seconds of a decoded time list.
seconds-in-a-day seconds-in-a-day The number of seconds in a day.
seconds-in-a-leap-year seconds-in-a-leap-year The number of seconds in a leap year.
seconds-in-a-normal-month seconds-in-a-normal-month The number of seconds in a 30-day month.
seconds-in-a-normal-year seconds-in-a-normal-year The number of seconds in a non-leap year.
seconds-in-a-week seconds-in-a-week The number of seconds in a week.
seconds-in-an-hour seconds-in-an-hour The number of seconds in an hour.
time-decode (time-decode n) Given an integer n, which is the number of second since january 1, 1970, return a list: (year month day minutes seconds).
time-encode (time-encode y mo d h mi s) An alias of second-count - encode year, month, day, hour, minutes, and seconds to an integer.
time-interval (time-interval second-count) Return the number of years, months, weeks, days, hours, minutes, and seconds from second-count.
time-ok? (time-ok? x) Return whether x is a legal time string (of the form "hhmm")
time-string (time-string second-count) Return the date, in the format "ddmmyyyy" of second-count, which represents the time in seconds elapsed since January 1, 1970.
time-zone-info time-zone-info Defines the time-zone.
transform-year-month-day-hour-minutes-strings (transform-year-month-day-hour-minutes-strings date time) Transform date and time strings to a second count (a large integer number of seconds elapsed since january 1, 1970).
weekday (weekday second-count) Given an integer, second-count, return the weekday of the time second-count.
weekday-number (weekday-number second-count) return the weekday-number of second-count (an integer).
when-generated (when-generated) Return a string that describes the current time as generation time.
year-month-day-decode-string (year-month-day-decode-string year-month-day-string) Decode a string of the form "y-m-d" to a list of the form (y m d).
year-of-time (year-of-time decoded-time-list) Return the year of a decoded time list.


1 Time zone and Daylight Saving Time correction.

time-zone-info
Form time-zone-info
Description Defines the time-zone. We also use this variable to adjust for daylight saving time. This is, however, kind of a hack. How many hours in front relative to Greenwich, England. The US east coast: 5. California 8. Denmark -1 If the encoded time is already corrected on your system, time-zone-info must be 0.
See also Scheme source file time-zone-info


2 Basic time functions.
According to the conventions used in LAML, the function current-time is assumed to return the current time, represented as the number of seconds elapsed since January 1, 1970, 00:00:00. In this section there are functions that encode and decode a number of seconds to and from a conventional time representation (in terms of year, month, day, hour, minutes, second).

time-decode
Form (time-decode n)
Description Given an integer n, which is the number of second since january 1, 1970, return a list: (year month day minutes seconds). The opposite function is called second-count
See also Scheme source file time-decode

second-count
Form (second-count y mo d h mi s)
Description Given date and time in terms of year y, month mo, day d, hour h, minutes mi, and seconds s, caluculate the second count. The second-count function compensates for time zone. The opposite function is called date-time.
See also Scheme source file second-count

time-encode
Form (time-encode y mo d h mi s)
Description An alias of second-count - encode year, month, day, hour, minutes, and seconds to an integer.
See also Scheme source file time-encode


3 Time selectors.
The selectors in this section work on decoded time lists. It means that the selectors just return a given element from the decoded list representation of time.

year-of-time
Form (year-of-time decoded-time-list)
Description Return the year of a decoded time list. An integer greater or equal to 1970.
See also Scheme source file year-of-time

month-of-time
Form (month-of-time decoded-time-list)
Description Return the month of a decoded time list. An integer in the interval 1..12
See also Scheme source file month-of-time

day-of-time
Form (day-of-time decoded-time-list)
Description Return the days of a decoded time list. An integer in the interval 1..31
See also Scheme source file day-of-time

hour-of-time
Form (hour-of-time decoded-time-list)
Description Return the hour of a decoded time list. An integer in the interval 0..23
See also Scheme source file hour-of-time

minute-of-time
Form (minute-of-time decoded-time-list)
Description Return the minutes of a decoded time list. An integer in the interval 0..59.
See also Scheme source file minute-of-time

second-of-time
Form (seconds-of-time decoded-time-list)
Description Return the seconds of a decoded time list. An integer in the interval 0..59.
See also Scheme source file second-of-time


4 Week days.
The functions in this section deal with week days. Both English and Danish week day names are supported the the variable language-preference in laml.scm.

weekday
Form (weekday second-count)
Description Given an integer, second-count, return the weekday of the time second-count. Returns a string.
See also Scheme source file weekday

brief-weekday
Form (brief-weekday second-count)
Description Given an integer, second-count, return the weekday as a brief string, of the time second-count. Returns a string.
See also Scheme source file brief-weekday


5 Week number and week day number.
The functions in this section deal with week numbering and, more simple, week day numbering.

danish-week-number
Form (danish-week-number sc)
Description Given a number sc, return the week number in which sc i located. Weeknumbers are treated by means of Danish weeknumber rules
See also Scheme source file danish-week-number

weekday-number
Form (weekday-number second-count)
Description Return the weekday-number of second-count (an integer). Monday is day number 1 in the week, sunday is day number 7.
See also Scheme source file weekday-number


6 Time pretty printing.
The functions in this section return pretty printed string representation of time.

date-time
Form (date-time second-count)
Description Given an integer, second-cound, return a list of two strings: (date time). This is useful in cases you need to print the data or time as a string. Takes the variable language preference into account.
See also Scheme source file date-time

date-time-one-string
Form (date-time-one-string second-count)
Description Return a single string that pretty prints the time represented by second count. Takes the variable language preference into account.
See also Scheme source file date-time-one-string

when-generated
Form (when-generated)
Description Return a string that describes the current time as generation time. Takes the variable language-preference into account.
See also Scheme source file when-generated
similar function in xhtml1.0-convenience.scm when-modified


7 Time interval functions.

time-interval
Form (time-interval second-count)
Description Return the number of years, months, weeks, days, hours, minutes, and seconds from second-count. A list of integers is returned.
See also Scheme source file time-interval

present-time-interval
Form (present-time-interval second-count)
Description Return a string which presens the number of years, months, weeks, days, hours, minutes, and seconds of second-count
See also Scheme source file present-time-interval


8 Conventional string representation of time.
This section contains a number of functions that deal with dates and time as strings in the formats such as "ddmmyyyy" and "hhmm". The seconds are not part of the string representation.

transform-year-month-day-hour-minutes-strings
Form (transform-year-month-day-hour-minutes-strings date time)
Description Transform date and time strings to a second count (a large integer number of seconds elapsed since january 1, 1970). The date parameter is a string of the form "ddmmyyyy" (eight ciffers). The time parameter is of the form "hhmm" (four ciffers). Assumes as a prefix that date and time represent a legal point in time. Use date-ok? and time-ok? to assure this. Return #f if date is blank (or if both date and time is blank).
See also Scheme source file transform-year-month-day-hour-minutes-strings

date-string
Form (date-string second-count)
Description Return the date, in the format "ddmmyyyy" of second-count, which represents the time in seconds elapsed since January 1, 1970.
See also Scheme source file date-string

time-string
Form (time-string second-count)
Description Return the date, in the format "ddmmyyyy" of second-count, which represents the time in seconds elapsed since January 1, 1970.
See also Scheme source file time-string

date-ok?
Form (date-ok? x)
Description Return whether x is a legal date string (of the form "ddmmyyyy") Exact determination, including february and leap years. Uses days-in-month from the time library.
See also Scheme source file date-ok?

time-ok?
Form (time-ok? x)
Description Return whether x is a legal time string (of the form "hhmm")
See also Scheme source file time-ok?

hours-minutes-decode-string
Form (hours-minutes-decode-string hour-minute-string)
Description Decode a string of the form "h:m" or "h.m" to a list of the form (h m). Does also accept the juxtaposition "hm" in which case m is taken as the last two ciffers. Given for instance "12:35", "12.35" or "1235" return (12 35).
See also Scheme source file hours-minutes-decode-string

year-month-day-decode-string
Form (year-month-day-decode-string year-month-day-string)
Description Decode a string of the form "y-m-d" to a list of the form (y m d). A proper list of three integers. Given for instance "2005-9-12", return the list (2005 9 12) representing September 12, 2005.
See also Scheme source file year-month-day-decode-string


9 Underlying time related constants and functions.
In this section there is a number of auxiliary time functions. In addition, we document a number of time related constants.

seconds-in-a-normal-year
Form seconds-in-a-normal-year
Description The number of seconds in a non-leap year.
See also Scheme source file seconds-in-a-normal-year

seconds-in-a-leap-year
Form seconds-in-a-leap-year
Description The number of seconds in a leap year.
See also Scheme source file seconds-in-a-leap-year

seconds-in-a-normal-month
Form seconds-in-a-normal-month
Description The number of seconds in a 30-day month.
See also Scheme source file seconds-in-a-normal-month

seconds-in-a-week
Form seconds-in-a-week
Description The number of seconds in a week.
See also Scheme source file seconds-in-a-week

seconds-in-a-day
Form seconds-in-a-day
Description The number of seconds in a day.
See also Scheme source file seconds-in-a-day

seconds-in-an-hour
Form seconds-in-an-hour
Description The number of seconds in an hour.
See also Scheme source file seconds-in-an-hour

get-month-name
Form (get-month-name month-number)
Description Return the month name of month-number. January is number one. The result depends on the free variable language-preference.
See also Scheme source file get-month-name
applied variable language-preference

leap-year
Form (leap-year y)
Description Return whether y is a leap year.
See also Scheme source file leap-year

days-in-month
Form (days-in-month month year)
Description Return the number of days in month and year
See also Scheme source file days-in-month

hours-minutes-seconds-decode
Form (hours-minutes-seconds-decode second-count)
Description Return a list of (hours minutues seconds) given an integer second-count.
See also Scheme source file hours-minutes-seconds-decode

Generated: Sunday, December 4, 2005, 22:41:15
Generated by LAML SchemeDoc using LAML Version 30.2 (November 29, 2005, full, alpha)