         { [ dup 172800 < ] [ drop "1 day ago" ] }
         [ 86400 / "%d days ago" sprintf ]
     } cond ;
+
+M: duration relative-time
+    duration>seconds relative-time ;
+
+M: timestamp relative-time
+    now swap time- relative-time ;

        ] each drop
    ] { } make [ "0s" ] [ reverse " " join ] if-empty ;

: relative-time ( seconds -- string )
    dup 0 < [ "negative seconds" throw ] when {
        { [ dup 1 < ] [ drop "just now" ] }
        { [ dup 60 < ] [ drop "less than a minute ago" ] }

! Copyright (C) 2010 John Benediktsson
! See http://factorcode.org/license.txt for BSD license

USING: calendar combinators formatting kernel make math
math.parser sequences ;

IN: calendar.elapsed

GENERIC: elapsed-time ( seconds -- string )

M: real elapsed-time
    dup 0 < [ "negative seconds" throw ] when [
        {
            { 60 "s" }
