Next: , Previous: POSIX file system access, Up: POSIX interface


8.7 Time

A time record contains an integer that represents a time as the number of seconds since the Unix epoch (00:00:00 GMT, January 1, 1970). These procedures for operating on time records are in the structures posix-time & posix.

— procedure: make-time seconds –> time
— procedure: current-time –> time
— procedure: time? object –> boolean
— procedure: time-seconds time –> integer

Make-time & current-time construct time records; make-time uses the number of seconds that is its argument, and current-time uses the current number of seconds since the epoch. Time? is the disjoint type predicate for time objects. Time-seconds returns the number of seconds recorded by time.

— procedure: time=? timea timeb –> boolean
— procedure: time<? timea timeb –> boolean
— procedure: time<=? timea timeb –> boolean
— procedure: time>? timea timeb –> boolean
— procedure: time>=? timea timeb –> boolean

Various time comparators. Time=? returns true if its two arguments represent the same number of seconds since the epoch. Time<?, time<=?, time>?, & time>= return true if their arguments are monotonically increasing, monotonically non-decreasing, monotonically decreasing, or monotonically non-increasing, respectively.

— procedure: time->string time –> string

Returns a string representation of time in the format of "DDD MMM HH:MM:SS YYYY". For example,

          (time->string (make-time 1234567890))
              => "Fri Feb 13 18:31:30 2009"

Note: The string has a newline suffix.