Learn Shen
Community Wiki
OS Kernel
OS Library
Shen Professional


The Calendar Package

This package includes a basic calendar program for returning dates. It is borrowed from the open source version which has suffered some bit rot since it was created. The SP version is fully functional and is part of the STE plugin.

Basic Functions

gmt : symbol --> number --> number --> number --> (symbol * number * number * number)

This function receives input in the form + or - folloed by three positive numbers and adjusts all results to local time. Values are entered in the order hours, minutes and seconds so (gmt – 6 45 7) gives GMT -6:45:07.

(0+) (gmt - 6 45 7)
(@p - (@p 6 (@p 45 7))) : (symbol * (number * (number * number)))

Values for hours are in the range 0-12, for minutes 0-59 and for seconds 0-59. User input is validated before being accepted.

The gmt function sets the local time for the other functions in this package. By default the value for GMT is 0:0:0; the time at Greenwich itself.

internal-date : (number --> (list number))

This function receives input in the form of an integer and returns the internal date form which represents the date at the time asked for. Entering 0 gives the current date. Entering a negative number m gives the date m days in the past and a positive number n, the date n days in the future. The result is returned as a list of numbers [Seconds Hours Days Month Year] adjusted for local time. The internal-date function is designed around Unix time and will not regress a date before January 2nd 1970.


now : (number --> string)

This function acts as internal-date but the result is returned as a string. (now 0) returns for me today’s date and local time "11:44:46, 12th December, 2012 +GMT 00:00:00"