brief-date-and-timeDate and Timebrief-run-time-durationbrief-durationGoTo Top

brief-duration   seconds &optional maximum-fields destination => result[Function]

Purpose
Format a numeric time duration (in seconds) into brief 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
    brief-run-time-duration
    parse-duration
    pretty-duration
    pretty-run-time-duration

Examples

  > (brief-duration 1000)
  "16m 40s"
  > (brief-duration -1000)
  "-16m 40s"
  > (brief-duration -1000.12345)
  "-16m 40.12s"
  > (brief-duration -1000.12543)
  "-16m 40.13s"
  > (brief-duration 166611.9)
  "1d 22h 16m 51.91s"
  > (brief-duration 166611.9 4)
  "1d 22h 16m 52s"
  > (brief-duration 166611.9 3)
  "1d 22h 17m"
  > (brief-duration 166611.9 2)
  "1d 22h"
  > (brief-duration 166611.9 1)
  "2d"
  > (brief-duration 31556952)
  "365d 5h 49m 12s"
  >


The GBBopen Project


brief-date-and-timeDate and Timebrief-run-time-durationbrief-durationGoTo Top