Use TYPED: in a few places in calendar.format to avoid passing durations instead of timestamps

db4
Doug Coleman 2010-03-02 04:31:17 -06:00
parent 55c606f274
commit b059ade5ed
1 changed files with 6 additions and 6 deletions

View File

@ -1,8 +1,8 @@
! Copyright (C) 2008, 2010 Slava Pestov, Doug Coleman. ! Copyright (C) 2008, 2010 Slava Pestov, Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: math math.order math.parser math.functions kernel USING: accessors arrays calendar calendar.format.macros
sequences io accessors arrays io.streams.string splitting combinators io io.streams.string kernel math math.functions
combinators calendar calendar.format.macros present ; math.order math.parser present sequences typed ;
IN: calendar.format IN: calendar.format
: pad-00 ( n -- str ) number>string 2 CHAR: 0 pad-head ; : pad-00 ( n -- str ) number>string 2 CHAR: 0 pad-head ;
@ -272,16 +272,16 @@ ERROR: invalid-timestamp-format ;
: (timestamp>ymd) ( timestamp -- ) : (timestamp>ymd) ( timestamp -- )
{ YYYY "-" MM "-" DD } formatted ; { YYYY "-" MM "-" DD } formatted ;
: timestamp>ymd ( timestamp -- str ) TYPED: timestamp>ymd ( timestamp: timestamp -- str )
[ (timestamp>ymd) ] with-string-writer ; [ (timestamp>ymd) ] with-string-writer ;
: (timestamp>hms) ( timestamp -- ) : (timestamp>hms) ( timestamp -- )
{ hh ":" mm ":" ss } formatted ; { hh ":" mm ":" ss } formatted ;
: timestamp>hms ( timestamp -- str ) TYPED: timestamp>hms ( timestamp: timestamp -- str )
[ (timestamp>hms) ] with-string-writer ; [ (timestamp>hms) ] with-string-writer ;
: timestamp>ymdhms ( timestamp -- str ) TYPED: timestamp>ymdhms ( timestamp: timestamp -- str )
[ [
>gmt >gmt
{ (timestamp>ymd) " " (timestamp>hms) } formatted { (timestamp>ymd) " " (timestamp>hms) } formatted