The TIME library#

This time library is intended as a modernization of Open Dylan’s “date” module in the “system” library. It has a nanosecond precision and more efficient time representation, and a more complete API.

Current Status#

  • This is alpha software.

  • It works only on Linux (possibly on macOS but it hasn’t been tried).

  • It works only on 64-bit machines.

  • It can get the current time, to nanosecond precision.

  • It can format times and durations.

  • Fixed-offset timezones work.

  • Support for “aware” timezones is underway. Support for TZif format is about half done.

  • The API should be considered provisional.

You have been warned. Enjoy!

Note

This documentation contains little more than the stubs auto-generated by export -format rst interface-reference. Use the sauce, Luke.

Reference#

Each of the following constants is bound to the corresponding instance of <month>.

$january Constant#
$february Constant#
$march Constant#
$april Constant#
$may Constant#
$june Constant#
$july Constant#
$august Constant#
$september Constant#
$october Constant#
$november Constant#
$december Constant#

Each of the following constants is bound to the corresponding length of a <duration>. (Caveat emptor etc etc)

$week Constant#
$day Constant#
$hour Constant#
$minute Constant#
$second Constant#
$millisecond Constant#
$microsecond Constant#
$nanosecond Constant#

Each of the following constants is bound to the corresponding instance of <day>.

$monday Constant#
$tuesday Constant#
$wednesday Constant#
$thursday Constant#
$friday Constant#
$saturday Constant#
$sunday Constant#

Each of the following constants is an instance of <time-format>.

$rfc3339 Constant#
$rfc3339-microseconds Constant#
$rfc3339-milliseconds Constant#

Each of the following constants is bound to the corresponding instance of <time>.

$epoch Constant#
$minimum-time Constant#
$maximum-time Constant#
$utc Constant#

An instance of <zone> representing Coordinated Universal Time (UTC).

<day> Class#
Superclasses:

<object>

Init-Keywords:
  • long-name (required) – An instance of <string>.

  • short-name (required) – An instance of <string>.

<duration> Class#
Superclasses:

<object>

Init-Keywords:
<month> Class#
Superclasses:

<object>

Init-Keywords:
  • days (required) – An instance of <integer>.

  • long-name (required) – An instance of <string>.

  • number (required) – An instance of <integer>.

  • short-name (required) – An instance of <string>.

<time-error> Class#
Superclasses:

<simple-error>

<time-format> Class#
Superclasses:

<object>

Init-Keywords:
<time> Primary Class#
Superclasses:

<object>

Init-Keywords:
  • days (required) – An instance of <integer>.

  • nanoseconds (required) – An instance of <integer>.

  • zone – An instance of <zone>.

<zone> Abstract Class#
Superclasses:

<object>

Init-Keywords:
  • name (required) – An instance of <string>.

compose-time Generic function#
Signature:

compose-time (y mon d h min sec nano zone) => (_)

Parameters:
Values:
  • _ – An instance of <time>.

day-long-name Generic function#
Signature:

day-long-name (object) => (value)

Parameters:
  • object – An instance of {<day> in time}.

Values:
day-short-name Generic function#
Signature:

day-short-name (object) => (value)

Parameters:
  • object – An instance of {<day> in time}.

Values:
duration-nanoseconds Generic function#
Signature:

duration-nanoseconds (object) => (value)

Parameters:
  • object – An instance of {<duration> in time}.

Values:
find-zone Function#
Signature:

find-zone (name #key zones) => (zone)

Parameters:
Values:
  • zone – An instance of <zone>?.

format-duration Generic function#
Signature:

format-duration (stream duration #key long?) => ()

Parameters:
  • stream – An instance of <stream>.

  • duration – An instance of <duration>.

  • long? (#key) – An instance of <boolean>.

format-time Generic function#
Signature:

format-time (stream format time #key zone) => ()

Parameters:
  • stream – An instance of <stream>.

  • format – An instance of <object>.

  • time – An instance of <time>.

  • zone (#key) – An instance of <object>.

format-time(<stream>, <time-format>, <time>) Method#
format-time(<stream>, <string>, <time>) Method#
format-time(<stream>, <sequence>, <time>) Method#
local-time-zone Generic function#
Signature:

local-time-zone () => (zone)

Values:
  • zone – An instance of <zone>.

month-days Generic function#
Signature:

month-days (object) => (value)

Parameters:
  • object – An instance of {<month> in time}.

Values:
month-long-name Generic function#
Signature:

month-long-name (object) => (value)

Parameters:
  • object – An instance of {<month> in time}.

Values:
month-number Generic function#
Signature:

month-number (object) => (value)

Parameters:
  • object – An instance of {<month> in time}.

Values:
month-short-name Generic function#
Signature:

month-short-name (object) => (value)

Parameters:
  • object – An instance of {<month> in time}.

Values:
parse-day Generic function#
Signature:

parse-day (name) => (d)

Parameters:
Values:
  • d – An instance of <day>.

parse-duration Generic function#
Signature:

parse-duration (s #key start end) => (d end-position)

Parameters:
Values:
parse-time Generic function#
Signature:

parse-time (input #key format zone) => (time)

Parameters:
Values:
  • time – An instance of <time>.

time-components Generic function#
Signature:

time-components (t #key zone) => (y mon d h min sec nano zone dow)

Parameters:
  • t – An instance of <time>.

  • zone (#key) – An instance of <zone>?.

Values:
time-day-of-month Generic function#
Signature:

time-day-of-month (t) => (day-of-month)

Parameters:
  • t – An instance of <time>.

Values:
time-day-of-week Generic function#
Signature:

time-day-of-week (t) => (_)

Parameters:
  • t – An instance of <time>.

Values:
  • _ – An instance of <day>.

time-hour Generic function#
Signature:

time-hour (t) => (hour)

Parameters:
  • t – An instance of <time>.

Values:
time-in-zone Generic function#
Signature:

time-in-zone (t zone) => (t2)

Parameters:
  • t – An instance of <time>.

  • zone – An instance of <zone>.

Values:
  • t2 – An instance of <time>.

time-minute Generic function#
Signature:

time-minute (t) => (minute)

Parameters:
  • t – An instance of <time>.

Values:
time-month Generic function#
Signature:

time-month (t) => (month)

Parameters:
  • t – An instance of <time>.

Values:
  • month – An instance of <month>.

time-nanosecond Generic function#
Signature:

time-nanosecond (t) => (nanosecond)

Parameters:
  • t – An instance of <time>.

Values:
time-now Generic function#
Signature:

time-now (#key zone) => (t)

Parameters:
  • zone (#key) – An instance of <zone>.

Values:
  • t – An instance of <time>.

time-second Generic function#
Signature:

time-second (t) => (second)

Parameters:
  • t – An instance of <time>.

Values:
time-year Generic function#
Signature:

time-year (t) => (year)

Parameters:
  • t – An instance of <time>.

Values:
time-zone Generic function#
Signature:

time-zone (t) => (zone)

Parameters:
  • t – An instance of <time>.

Values:
  • zone – An instance of <zone>.

zone-abbreviation Generic function#
Signature:

zone-abbreviation (zone #key time) => (abbrev)

Parameters:
  • zone – An instance of <zone>.

  • time (#key) – An instance of <object>.

Values:
zone-abbreviation(<naive-zone>) Method#
zone-abbreviation(<aware-zone>) Method#
zone-daylight-savings? Generic function#
Signature:

zone-daylight-savings? (zone #key time) => (dst?)

Parameters:
  • zone – An instance of <zone>.

  • time (#key) – An instance of <object>.

Values:
zone-daylight-savings?(<naive-zone>) Method#
zone-daylight-savings?(<aware-zone>) Method#
zone-name Generic function#
Signature:

zone-name (object) => (value)

Parameters:
  • object – An instance of {<zone> in time}.

Values:
zone-offset-seconds Generic function#
Signature:

zone-offset-seconds (zone #key time) => (seconds)

Parameters:
  • zone – An instance of <zone>.

  • time (#key) – An instance of <object>.

Values:
zone-offset-seconds(<naive-zone>) Method#
zone-offset-seconds(<aware-zone>) Method#
zone-offset-string Generic function#
Signature:

zone-offset-string (zone #key time) => (offset)

Parameters:
  • zone – An instance of <zone>.

  • time (#key) – An instance of <object>.

Values:
zone-offset-string(<naive-zone>) Method#
zone-offset-string(<aware-zone>) Method#

Indices and tables#