On this page:
9.0
top
up

3Time-of-DayπŸ”— i

Gregor’s time struct represents a time-of-day, irrespective of date or time zone. As with Gregor’s date struct, the name time also conflicts with an existing, incompatible definition in racket/base. The situation here is somewhat different, however. While Gregor completely replaces the functionality offered by the built-in date, it does not replace that of the built-in time function, which is used for measuring the time spent evaluating programs.

To mitigate problems that might be caused by this conflict, Gregor does not provide time -related bindings from the gregor module. Instead, they are provided by the gregor/time module.

procedure

( time hour[minutesecondnanosecond])time?

hour:(integer-in 023)
minute:(integer-in 059)=0
second:(integer-in 059)=0
nanosecond:(integer-in 0999999999)=0
Constructs a time with the given hour, minute, second, and nanosecond values.

Note the contract on second; a time is unable to represent times that fall on added UTC leap-seconds. For a discussion of Gregor’s relationship to UTC, see Time Scale.

Examples:
> (time 1234)

#<time 01:02:03.000000004>

> (time 0)

#<time 00:00:00>

> (time 12)

#<time 12:00:00>

procedure

( time? x)boolean?

x:any/c
Returns #t if x is a time ; #f otherwise.

procedure

( time->iso8601 t)string?

t:time?
Returns an ISO 8601 string representation of t.

Examples:
> (time->iso8601 (time 1234))

"01:02:03.000000004"

"00:00:00"

"12:00:00"

procedure

( time=? xy)boolean?

x:time?
y:time?

procedure

( time<? xy)boolean?

x:time?
y:time?

procedure

( time<=? xy)boolean?

x:time?
y:time?

procedure

( time>? xy)boolean?

x:time?
y:time?

procedure

( time>=? xy)boolean?

x:time?
y:time?
Comparison functions on times.

Examples:
> (time=? (time 1200)(time 12))

#t

> (time<? (time 130)(time 1330))

#t

> (time>? (time 1234)(time 123))

#t

An order defined on times.

Examples:
> (time-order (time 1200)(time 12))

'=

> (time-order (time 130)(time 1330))

'<

> (time-order (time 1234)(time 123))

'>

#<splay-tree*>

top
up

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /