]> gitweb.factorcode.org Git - factor.git/commitdiff
calendar: use ago instead of `now swap time-`
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 16 Jun 2023 16:37:37 +0000 (12:37 -0400)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 9 Jul 2023 13:55:14 +0000 (08:55 -0500)
basis/calendar/format/format.factor
extra/site-watcher/site-watcher.factor
extra/zeromq/examples/tasksink.factor

index 8a30cb0b9a5d72099234b8ac2d9363925fe782e9..b2f6ee388eb694ef5b0473b77f536229cbac997d 100644 (file)
@@ -247,7 +247,7 @@ M: duration elapsed-time
     duration>seconds elapsed-time ;
 
 M: timestamp elapsed-time
-    now swap time- elapsed-time ;
+    ago elapsed-time ;
 
 ! XXX: Anything up to 2 hours is "about an hour"
 : relative-time-offset ( seconds -- string )
@@ -277,4 +277,4 @@ M: duration relative-time
     duration>seconds relative-time ;
 
 M: timestamp relative-time
-    now swap time- relative-time ;
+    ago relative-time ;
index 00344e8b795f7d177dd85ddb8c1cd673b9a06fd7..2aa2a43f0d3dc86349f3dba80970a19bcf15fc24 100644 (file)
@@ -19,7 +19,7 @@ STARTUP-HOOK: [ f running-site-watcher set-global ]
     ] each ;
 
 : site-up-email ( site -- body )
-    last-up>> now swap time- duration>minutes 60 /mod
+    last-up>> ago duration>minutes 60 /mod
     [ >integer number>string ] bi@
     [ " hours, " append ] [ " minutes" append ] bi* append
     "Site was down for (at least): " prepend ;
index 74f2c153ee5f7f500e12dad7a4de39a0d3029d18..0655cbe5ad21114700f5e22f962c9a6ab5832e0d 100644 (file)
@@ -19,7 +19,7 @@ IN: zeromq.examples.tasksink
             10 rem zero? [ ":" ] [ "." ] if write flush
         ] each
         ! Calculate and report duration of batch
-        now swap time- duration>milliseconds "Total elapsed time: %d msec\n" printf
+        ago duration>milliseconds "Total elapsed time: %d msec\n" printf
         drop
     ] with-destructors ;