Module Kwformat.Units

module Units: sig .. end
Format a quantity in terms of some units

val time : (int64 * string * 'a option) list
units of time: second, minute, hour, day, week, month, year
val kib : (int64 * string * 'a option) list
units of mass storage, base of 1024: byte through exbibyte
val kb : (int64 * string * 'a option) list
units of mass storage, base of 1000: byte through exibyte
val format : ?maxunit:string -> (int64 * string * string option) list -> int64 -> string
format ?maxunit units quantity

Example:

# format time 2175;;
\- : string = "5 hours, 51 minutes, 15 seconds"
# format ~maxunit:"minute" time 2175;;
\- : string = "36 minutes, 15 seconds"
   

Partially-apply for efficiency.

maxunit : optional maximum unit to use in formatting
units : data structure describing units; list of (product, name, irregular plural)