On this page:
current-clock
current-posix-seconds
today
today/  utc
current-time
current-time/  utc
now
now/  utc
now/  moment
now/  moment/  utc
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.

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))

procedure

(today [#:tz tz])  date?

  tz : tz/c = (current-timezone)

procedure

(today/utc)  date?

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>)

procedure

(now [#:tz tz])  datetime?

  tz : tz/c = (current-timezone)

procedure

(now/utc)  datetime?

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

(now/moment/utc)  moment?

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]>)