The Time-IO Module

This module contains functions for basic time input and output.


format-time[Method]

Writes a <decoded-time> to a <stream> according to a format-string directive.

Synopsis

format-time (stream, format, time) => ()

Parameters

streamAn instance of <stream>. Where the formatted time is going
formatAn instance of <string>. The instructions for formatting the time
timeAn instance of <decoded-time>. The time instance to format

Return Values

None.

Description

Format a <decoded-time> for output on a <stream>. The format arguments are described in the next section.


parse-time[Function]

Takes data on a stream and applies format arguments to return a <decoded-time>.

Synopsis

parse-time (input, format-string) => (res)

Parameters

inputAn instance of <stream>. Contains input data to be converted
format-stringAn instance of <string>. Contains formatting directives (described in Time-IO) to parse the data on the stream into a <decoded-time> instance.

Return Values

resAn instance of <decoded-time>.

Description

Very useful function for when (e.g.) a user is asked to enter time information, or when (e.g.) reading in a text file of records which include dates or times. Parse-time allows the program to convert the input into a <decoded-time> instance.

This module contains two internal classes that provide information on the parse process


<parse-time-error>[sealed Class]

Contains the error in parsing time format directives.

Superclasses

<error>

Initialization Keywords

parse-state:An instance of <parse-state>. The <parse-state> class is described below
error-format-string:An instance of <string>. The control string for textual error representation
error-format-args:An instance of <sequence>. The arguments to the format-string

Description

The error we signal when we have trouble parsing something. Note that an unknown format directive is *not* considered a <time-parsing-error>, but a normal, unnamed (and close to uncatchable) error.


<parse-state>[sealed Class]

A parser containing the input stream, the formatting directives, and information about the status on the parse process.

Superclasses

<object>

Initialization Keywords

format-string:An instance of <string>. The format-string we are trying to parse the time with
format-stream:An instance of <stream>. format-string, as a stream
input-stream:An instance of <stream>. The stream we're trying to parse

Description

This class contains several other slots containing information about the parse state: