Handbook
Glossary
relative-time-offset ( seconds -- string )
Vocabulary
calendar
.
format
Inputs
seconds
an
object
Outputs
string
an
object
Definition
USING:
combinators
formatting
kernel
math
;
IN:
calendar.format
:
relative-time-offset
( seconds -- string )
abs
{
{
[
dup
1
<
]
[
drop
"just now"
]
}
{
[
dup
60
<
]
[
drop
"less than a minute"
]
}
{
[
dup
120
<
]
[
drop
"about a minute"
]
}
{
[
dup
2700
<
]
[
60
/i
"%d minutes"
sprintf
]
}
{
[
dup
7200
<
]
[
drop
"about an hour"
]
}
{
[
dup
86400
<
]
[
3600
/i
"%d hours"
sprintf
]
}
{
[
dup
172800
<
]
[
drop
"1 day"
]
}
[
86400
/i
"%d days"
sprintf
]
}
cond
;