Struct Unit

A unit allows to easily print mixed resolution values. Typical examples include time (with hours, minutes, ...) and distances (with km, m, cm, mm). The unitclass simplifies definition of such things as well as transforming a high resolution value, to a supposedly more human readable representation. e.g. 3_610_123 would convert to 1h 0m 10s 123ms.

struct Unit ;

Constructors

NameDescription
this

Fields

NameTypeDescription
name stringname of the unit
scales Unit.Scale[]resolutions of the unit

Methods

NameDescription
scale factory for Scale
transform transforms the unit to its parts

Inner structs

NameDescription
Part One part of the transformed Unit. a part of a unit is e.g. the minute resolution of a duration.
Scale A scale is one resolution of a unit.