fix calendar for <=> change
parent
32814ffce5
commit
47abbfc4c6
|
@ -131,16 +131,16 @@ IN: calendar.tests
|
||||||
[ t ] [ 2004 1 1 23 0 0 9+1/2 hours <timestamp> >gmt
|
[ t ] [ 2004 1 1 23 0 0 9+1/2 hours <timestamp> >gmt
|
||||||
2004 1 1 13 30 0 instant <timestamp> = ] unit-test
|
2004 1 1 13 30 0 instant <timestamp> = ] unit-test
|
||||||
|
|
||||||
[ 0 ] [ 2004 1 1 13 30 0 instant <timestamp>
|
[ +eq+ ] [ 2004 1 1 13 30 0 instant <timestamp>
|
||||||
2004 1 1 12 30 0 -1 hours <timestamp> <=> ] unit-test
|
2004 1 1 12 30 0 -1 hours <timestamp> <=> ] unit-test
|
||||||
|
|
||||||
[ 1 ] [ 2004 1 1 13 30 0 instant <timestamp>
|
[ +gt+ ] [ 2004 1 1 13 30 0 instant <timestamp>
|
||||||
2004 1 1 12 30 0 instant <timestamp> <=> ] unit-test
|
2004 1 1 12 30 0 instant <timestamp> <=> ] unit-test
|
||||||
|
|
||||||
[ -1 ] [ 2004 1 1 12 30 0 instant <timestamp>
|
[ +lt+ ] [ 2004 1 1 12 30 0 instant <timestamp>
|
||||||
2004 1 1 13 30 0 instant <timestamp> <=> ] unit-test
|
2004 1 1 13 30 0 instant <timestamp> <=> ] unit-test
|
||||||
|
|
||||||
[ 1 ] [ 2005 1 1 12 30 0 instant <timestamp>
|
[ +gt+ ] [ 2005 1 1 12 30 0 instant <timestamp>
|
||||||
2004 1 1 13 30 0 instant <timestamp> <=> ] unit-test
|
2004 1 1 13 30 0 instant <timestamp> <=> ] unit-test
|
||||||
|
|
||||||
[ t ] [ now timestamp>millis millis - 1000 < ] unit-test
|
[ t ] [ now timestamp>millis millis - 1000 < ] unit-test
|
||||||
|
|
|
@ -87,10 +87,10 @@ M: timestamp year. ( timestamp -- )
|
||||||
[ hh ] [ mm ] bi ;
|
[ hh ] [ mm ] bi ;
|
||||||
|
|
||||||
: write-gmt-offset ( gmt-offset -- )
|
: write-gmt-offset ( gmt-offset -- )
|
||||||
dup instant <=> sgn {
|
dup instant <=> {
|
||||||
{ 0 [ drop "GMT" write ] }
|
{ +eq+ [ drop "GMT" write ] }
|
||||||
{ -1 [ "-" write before (write-gmt-offset) ] }
|
{ +lt+ [ "-" write before (write-gmt-offset) ] }
|
||||||
{ 1 [ "+" write (write-gmt-offset) ] }
|
{ +gt+ [ "+" write (write-gmt-offset) ] }
|
||||||
} case ;
|
} case ;
|
||||||
|
|
||||||
: timestamp>rfc822 ( timestamp -- str )
|
: timestamp>rfc822 ( timestamp -- str )
|
||||||
|
@ -118,10 +118,10 @@ M: timestamp year. ( timestamp -- )
|
||||||
[ hh ":" write ] [ mm ] bi ;
|
[ hh ":" write ] [ mm ] bi ;
|
||||||
|
|
||||||
: write-rfc3339-gmt-offset ( duration -- )
|
: write-rfc3339-gmt-offset ( duration -- )
|
||||||
dup instant <=> sgn {
|
dup instant <=> {
|
||||||
{ 0 [ drop "Z" write ] }
|
{ +eq+ [ drop "Z" write ] }
|
||||||
{ -1 [ "-" write before (write-rfc3339-gmt-offset) ] }
|
{ +lt+ [ "-" write before (write-rfc3339-gmt-offset) ] }
|
||||||
{ 1 [ "+" write (write-rfc3339-gmt-offset) ] }
|
{ +gt+ [ "+" write (write-rfc3339-gmt-offset) ] }
|
||||||
} case ;
|
} case ;
|
||||||
|
|
||||||
: (timestamp>rfc3339) ( timestamp -- )
|
: (timestamp>rfc3339) ( timestamp -- )
|
||||||
|
|
Loading…
Reference in New Issue