6.3.90.900
14 Current Date and Time
parameter
(current-clock) → (-> rational?)
(current-clock clock) → void? clock : (-> rational?)
= current-posix-seconds
A parameter that defines the current clock used by all functions
that require the current time. A clock is simply a nullary function that
returns the number of seconds since the UNIX epoch.
The default value is current-posix-seconds.
procedure
Returns the number of seconds since the UNIX epoch as a rational number.
This function is implemented as:
(define (current-posix-seconds) (/ (inexact->exact (current-inexact-milliseconds)) 1000))
Returns the current date in the specified time zone.
Example:
> (parameterize ([current-clock (λ () 0)]) (list (today/utc) (today #:tz "America/Chicago"))) '(#<date 1970-01-01> #<date 1969-12-31>)
procedure
(current-time [#:tz tz]) → time?
tz : tz/c = (current-timezone)
procedure
(current-time/utc) → time?
Returns the current time in the specified time zone.
Example:
> (parameterize ([current-clock (λ () 0)]) (list (current-time/utc) (current-time #:tz "America/Chicago"))) '(#<time 00:00:00> #<time 18:00:00>)
Returns the current datetime in the specified time zone.
Example:
> (parameterize ([current-clock (λ () 0)]) (list (now/utc) (now #:tz "America/Chicago"))) '(#<datetime 1970-01-01T00:00:00> #<datetime 1969-12-31T18:00:00>)
procedure
(now/moment [#:tz tz]) → moment?
tz : tz/c = (current-timezone)
procedure
Returns the current moment in the specified time zone.
Example:
> (parameterize ([current-clock (λ () 0)]) (list (now/moment/utc) (now/moment #:tz "America/Chicago")))
'(#<moment 1970-01-01T00:00:00Z[Etc/UTC]>
#<moment 1969-12-31T18:00:00-06:00[America/Chicago]>)