Handbook
Glossary
duration>years ( duration -- x )
Calendar
ยป
Using durations
Prev:
instant ( -- duration )
Next:
duration>months ( duration -- x )
Vocabulary
calendar
Inputs
duration
a
duration
Outputs
x
a
number
Word description
Calculates the length of a duration in years.
Examples
USING: calendar prettyprint ; 6 months duration>years .
1/2
See also
duration>months
,
duration>days
,
duration>hours
,
duration>minutes
,
duration>seconds
,
duration>milliseconds
,
duration>microseconds
,
duration>nanoseconds
Definition
USING:
accessors
combinators
kernel
math
;
IN:
calendar
:
duration>years
( duration -- x )
0
swap
{
[
year>>
+
]
[
month>>
months-per-year
/
+
]
[
day>>
days-per-year
/
+
]
[
hour>>
hours-per-year
/
+
]
[
minute>>
minutes-per-year
/
+
]
[
second>>
seconds-per-year
/
+
]
}
cleave
;