From 7025ebd7ee5f856751af7b205195fd828e808f91 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 31 Aug 2008 20:19:16 -0500 Subject: [PATCH] docs --- basis/calendar/calendar-docs.factor | 68 ++++++++++++++++++++++++++++- basis/calendar/calendar.factor | 1 - 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/basis/calendar/calendar-docs.factor b/basis/calendar/calendar-docs.factor index 2c23ae95c1..d3bfa7bcb1 100644 --- a/basis/calendar/calendar-docs.factor +++ b/basis/calendar/calendar-docs.factor @@ -184,7 +184,7 @@ HELP: time+ { $description "Adds two durations to produce a duration or adds a timestamp and a duration to produce a timestamp. The calculation takes timezones into account." } { $examples { $example "USING: calendar math.order prettyprint ;" - "10 months 2 months time+ 1 year <=> ." + "10 months 2 months time+ 1 years <=> ." "+eq+" } { $example "USING: accessors calendar math.order prettyprint ;" @@ -193,3 +193,69 @@ HELP: time+ } } ; +HELP: dt>years +{ $values { "duration" duration } { "x" number } } +{ $description "Calculates the length of a duration in years." } +{ $examples + { $example "USING: calendar prettyprint ;" + "6 months dt>years ." + "1/2" + } +} ; + +HELP: dt>months +{ $values { "duration" duration } { "x" number } } +{ $description "Calculates the length of a duration in months." } +{ $examples + { $example "USING: calendar prettyprint ;" + "30 days dt>months ." + "16000/16233" + } +} ; + +HELP: dt>days +{ $values { "duration" duration } { "x" number } } +{ $description "Calculates the length of a duration in days." } +{ $examples + { $example "USING: calendar prettyprint ;" + "6 hours dt>days ." + "1/4" + } +} ; + +HELP: dt>hours +{ $values { "duration" duration } { "x" number } } +{ $description "Calculates the length of a duration in hours." } +{ $examples + { $example "USING: calendar prettyprint ;" + "3/4 days dt>hours ." + "18" + } +} ; +HELP: dt>minutes +{ $values { "duration" duration } { "x" number } } +{ $description "Calculates the length of a duration in minutes." } +{ $examples + { $example "USING: calendar prettyprint ;" + "6 hours dt>minutes ." + "360" + } +} ; +HELP: dt>seconds +{ $values { "duration" duration } { "x" number } } +{ $description "Calculates the length of a duration in seconds." } +{ $examples + { $example "USING: calendar prettyprint ;" + "6 minutes dt>seconds ." + "360" + } +} ; +HELP: dt>milliseconds +{ $values { "duration" duration } { "x" number } } +{ $description "Calculates the length of a duration in milliseconds." } +{ $examples + { $example "USING: calendar prettyprint ;" + "6 seconds dt>milliseconds ." + "6000" + } +} ; diff --git a/basis/calendar/calendar.factor b/basis/calendar/calendar.factor index d9284573c4..36b3cf3250 100755 --- a/basis/calendar/calendar.factor +++ b/basis/calendar/calendar.factor @@ -395,7 +395,6 @@ M: timestamp days-in-year ( timestamp -- n ) year>> days-in-year ; : time-since-midnight ( timestamp -- duration ) dup midnight time- ; - M: timestamp sleep-until timestamp>millis sleep-until ; M: duration sleep hence sleep-until ;