[ t ] [ 2004 1 1 23 0 0 9+1/2 hours <timestamp> >gmt
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
-[ 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
-[ -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
-[ 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
[ t ] [ now timestamp>millis millis - 1000 < ] unit-test
[ hh ] [ mm ] bi ;\r
\r
: write-gmt-offset ( gmt-offset -- )\r
- dup instant <=> sgn {\r
- { 0 [ drop "GMT" write ] }\r
- { -1 [ "-" write before (write-gmt-offset) ] }\r
- { 1 [ "+" write (write-gmt-offset) ] }\r
+ dup instant <=> {\r
+ { +eq+ [ drop "GMT" write ] }\r
+ { +lt+ [ "-" write before (write-gmt-offset) ] }\r
+ { +gt+ [ "+" write (write-gmt-offset) ] }\r
} case ;\r
\r
: timestamp>rfc822 ( timestamp -- str )\r
[ hh ":" write ] [ mm ] bi ;\r
\r
: write-rfc3339-gmt-offset ( duration -- )\r
- dup instant <=> sgn {\r
- { 0 [ drop "Z" write ] }\r
- { -1 [ "-" write before (write-rfc3339-gmt-offset) ] }\r
- { 1 [ "+" write (write-rfc3339-gmt-offset) ] }\r
+ dup instant <=> {\r
+ { +eq+ [ drop "Z" write ] }\r
+ { +lt+ [ "-" write before (write-rfc3339-gmt-offset) ] }\r
+ { +gt+ [ "+" write (write-rfc3339-gmt-offset) ] }\r
} case ;\r
\r
: (timestamp>rfc3339) ( timestamp -- )\r