Generated: September 4, 2002, 15:49:24Copyright ©2002, Kurt NørmarkThe local LAML software home page

Reference Manual of the time library

Kurt Nørmark ©    normark@cs.auc.dk    Department of Computer Science    Aalborg University    Denmark    

Master index
Source file: lib/time.scm
LAML Version 18.00 (August 31, 2002) full

This is the date and time library, on which many LAML facilities rely. Time is represented as an integer, which represents the number of seconds since January 1, 1970. This library contains functions which translate from seconds to year, month, day, hour, and second. Also the reverse translation is provided for. Besides this, the library provides functions for calculating the weekday and the week number. Weekday and month names can be returned in either Danish og English, depending on the variable language-preference. The language-preference binds at a late time, not loadning time. Be aware that you need to modify the variable time-zone-info when summer and winter times are introduced.

Table of Contents:
1. Basic time functions.4. Time pretty printing.7. Underlying time related functions.
2. Week days.5. Time interval functions.
3. Week number and week day number.6. Conventional string representation of time.

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.
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.
leap-year(leap-year y)Return whether y is a leap year.
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.
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.
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.

 

1.   BASIC TIME FUNCTIONS.
According to LAML conventions, 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


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.


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.


 

2.   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.


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.


 

3.   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


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.


 

4.   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.


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.


when-generated


Form
(when-generated)

Description
Return a string that describes the current time as generation time. Takes the variable language preference into account.


 

5.   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.


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


 

6.   CONVENTIONAL STRING REPRESENTATION OF TIME.
This section contains a number of functions that deal with dates and time as strings in the formats: "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).


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.


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.


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.


time-ok?


Form
(time-ok? x)

Description
Return whether x is a legal time string (of the form "hhmm")


 

7.   UNDERLYING TIME RELATED FUNCTIONS.
In this section there is a number of more basic, but still useful time related functions and constants.


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.


leap-year


Form
(leap-year y)

Description
Return whether y is a leap year.


days-in-month


Form
(days-in-month month year)

Description
Return the number of days in month and year


Generated: September 4, 2002, 15:49:24
This documentation has been extracted automatically from the Scheme source file by means of the Schemedoc tool