]> gitweb.factorcode.org Git - factor.git/commitdiff
fix calendar for <=> change
authorDoug Coleman <doug.coleman@gmail.com>
Mon, 28 Apr 2008 03:44:30 +0000 (22:44 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Mon, 28 Apr 2008 03:44:30 +0000 (22:44 -0500)
extra/calendar/calendar-tests.factor
extra/calendar/format/format.factor

index e2a2bc7e66d0c6981bc38a8972dede8394a61830..7d9716ae1ad18d6a53497831e2f07a5400788303 100755 (executable)
@@ -131,16 +131,16 @@ IN: calendar.tests
 [ 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
index 26daaddc40b7422a175ffd8ca831687b3315e918..91a034f8bdcddf49f314a3157f4225bc7078bad3 100755 (executable)
@@ -87,10 +87,10 @@ M: timestamp year. ( timestamp -- )
     [ 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
@@ -118,10 +118,10 @@ M: timestamp year. ( timestamp -- )
     [ 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