pretty-run-time-intervalDate and Timepretty-time-intervalGoTo Top

pretty-time-interval   seconds &optional maximum-fields destination => result[Function]

Purpose
Format a numeric time interval (in seconds) into descriptive text.

Package   :gbbopen-tools

Module   :gbbopen-tools

Arguments and values

seconds     A number
maximum-fields     An integer from 1–5 indicating maximum number of fields to include in the descriptive string (default is 5, indicating all fields should be included)
destination     Either nil, t, a stream, or a string with a fill pointer (default is nil)
result     A string or nil

Returns
If destination is non-nil, then nil; otherwise, a string.

Description
The value of seconds is rounded to the nearest 100th of a second before conversion. Fields omitted by maximum-fields cause appropriate rounding of the generated description.

See also
    pretty-run-time-interval

Examples

  > (pretty-time-interval 1000)
  "16 minutes, 40 seconds"
  > (pretty-time-interval -1000)
  "minus 16 minutes, 40 seconds"
  > (pretty-time-interval -1000.12345)
  "minus 16 minutes, 40.12 seconds"
  > (pretty-time-interval -1000.12543)
  "minus 16 minutes, 40.13 seconds"
  > (pretty-time-interval 166611.9)
  "1 day, 22 hours, 16 minutes, 51.91 seconds"
  > (pretty-time-interval 166611.9 4)
  "1 day, 22 hours, 16 minutes, 52 seconds"
  > (pretty-time-interval 166611.9 3)
  "1 day, 22 hours, 17 minutes"
  > (pretty-time-interval 166611.9 2)
  "1 day, 22 hours"
  > (pretty-time-interval 166611.9 1)
  "2 days"
  >


The GBBopen Project


pretty-run-time-intervalDate and Timepretty-time-intervalGoTo Top