duration - Factor Documentation

duration
Calendar

Prev: timestamp


Vocabulary
calendar

Word description
A duration is a period of time years, months, days, hours, minutes, and seconds. All duration slots can store real numbers. Compare two durations with the <=> word.

See also
timestamp

Definition
USING: math ;

IN: calendar

TUPLE: duration
{ year real initial: 0 } { month real initial: 0 }
{ day real initial: 0 } { hour real initial: 0 }
{ minute real initial: 0 } { second real initial: 0 } ;


Methods
USING: calendar math.order ;

M: duration <=> [ duration>years ] compare ;


USING: calendar math timers.private ;

M: duration >nanoseconds duration>nanoseconds >integer ;


USING: calendar calendar.format ;

M: duration elapsed-time duration>seconds elapsed-time ;


USING: calendar calendar.format ;

M: duration relative-time duration>seconds relative-time ;


USING: calendar threads ;

M: duration sleep duration>nanoseconds sleep ;


USING: calendar kernel ;

M: duration time+
dup timestamp? [ swap time+ ] [ duration+ ] if ;


USING: calendar kernel ;

M: duration time-
over timestamp? [ before time+ ] [ duration- ] if ;

AltStyle によって変換されたページ (->オリジナル) /