Next: , Up: built-in time   [Contents][Index]


6.25.1 Time spans object-type

Built-in Type: <time>
Parent Type: <record>

Type name of time objects. It can represent both absolute times (typically elapsed times since the Epoch) and positive and negative time spans relative to an arbitrary origin. The internal time representation has nanosecond resolution and it is immutable.

Operations

Constructor on <time>: <time> constructor {seconds <exact-integer>} {nanoseconds <exact-integer>}
Constructor on <time>: <time> constructor {megaseconds <exact-integer>} {seconds <exact-integer>} {nanoseconds <exact-integer>}

Build and return a new <time> object. If nanoseconds exceeds #e1e9 its value is normalised and the excess added to seconds. If seconds exceeds #e1e6 its value is normalised and the excess added to megaseconds.

Type predicate on <time>: <boolean> type-predicate obj

Return #t if obj is a <time> object; otherwise return #f.

Equality predicate on <time>: <boolean> equality-predicate this {T <time>}

Return #t if the <time> objects are true, otherwise return #f. This equality predicate is used by equal?.

Comparison procedure on <time>: <fixnum> comparison-procedure this {T <time>}

Return -1 if T1 is less than T2; return 0 if T1 is equal to T2; return +1 if T1 is greater than T2.

Hash function on <time>: <fixnum> hash-function this

Return a non–negative fixnum representing the hash value for T. This hash function is used by the syntax hash.

Accessors

Method on <time>: <exact-integer> seconds this

The number of seconds in the represented time span.

Method on <time>: <fixnum> nanoseconds this

The number of nanoseconds in the represented time span.

Method on <time>: <ratnum> ratnum this
Method on <time>: <flonum> flonum this

Return a real number representing the time in seconds. This single number is built from seconds and nanoseconds.

Arithmetics

Method on <time>: <time> + this {T <time>} …

Compute the addition between time objects: this + T + ... and return a time object representing it.

Method on <time>: <time> - this {T <time>} …

When only the instance this is given: return the negation of the time object. When additional arguments T are given, compute the difference between time objects: this - (T + ...) and return a time object representing it.

Time comparison

Method on <time>: <boolean> = this {T <time>} …

Return #t if the time objects are equal, else return #f.

Method on <time>: <boolean> != this {T <time>} …

Return #t if the arguments are all different: no two arguments are equal; otherwise return #f. When this is the only argument: return #f.

Method on <time>: <boolean> < this {T <time>} …

Return #t if the time objects are monotonically increasing; else return #f.

Method on <time>: <boolean> <= this {T <time>} …

Return #t if the time objects are monotonically non–decreasing; else return #f.

Method on <time>: <boolean> > this {T <time>} …

Return #t if the time objects are monotonically decreasing; else return #f.

Method on <time>: <boolean> >= this {T <time>} …

Return #t if the time objects are monotonically non–increasing; else return #f.

Method on <time>: <boolean> max this {T <time>} …
Method on <time>: <boolean> min this {T <time>} …

Return the maximum or minimum between the arguments.


Next: , Up: built-in time   [Contents][Index]