calendar: today is now midnight.

db4
John Benediktsson 2012-02-02 19:47:05 -08:00
parent c730bf62bd
commit d8b963872b
2 changed files with 10 additions and 3 deletions

View File

@ -490,11 +490,15 @@ HELP: saturday
HELP: midnight HELP: midnight
{ $values { "timestamp" timestamp } { "new-timestamp" timestamp } } { $values { "timestamp" timestamp } { "new-timestamp" timestamp } }
{ $description "Returns a new timestamp that represents today at midnight, or the beginning of the day." } ; { $description "Returns a new timestamp that represents the day at midnight, or the beginning of the day." } ;
HELP: noon HELP: noon
{ $values { "timestamp" timestamp } { "new-timestamp" timestamp } } { $values { "timestamp" timestamp } { "new-timestamp" timestamp } }
{ $description "Returns a new timestamp that represents today at noon, or the middle of the day." } ; { $description "Returns a new timestamp that represents the day at noon, or the middle of the day." } ;
HELP: today
{ $values { "timestamp" timestamp } }
{ $description "Returns a timestamp that represents today at midnight." } ;
HELP: beginning-of-month HELP: beginning-of-month
{ $values { "timestamp" timestamp } { "new-timestamp" timestamp } } { $values { "timestamp" timestamp } { "new-timestamp" timestamp } }

View File

@ -416,8 +416,11 @@ M: timestamp day-name day-of-week day-names nth ;
: noon ( timestamp -- new-timestamp ) : noon ( timestamp -- new-timestamp )
midnight 12 >>hour ; inline midnight 12 >>hour ; inline
: today ( -- timestamp )
now midnight ; inline
: beginning-of-month ( timestamp -- new-timestamp ) : beginning-of-month ( timestamp -- new-timestamp )
midnight 1 >>day ; midnight 1 >>day ; inline
: end-of-month ( timestamp -- new-timestamp ) : end-of-month ( timestamp -- new-timestamp )
[ midnight ] [ days-in-month ] bi >>day ; [ midnight ] [ days-in-month ] bi >>day ;