]> gitweb.factorcode.org Git - factor.git/commitdiff
calendar: make code like '0.1 seconds sleep' work (bug discovered by Joe Groff)
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Wed, 6 Jan 2010 11:02:16 +0000 (00:02 +1300)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Wed, 6 Jan 2010 11:02:16 +0000 (00:02 +1300)
basis/calendar/calendar.factor
basis/threads/threads-tests.factor

index 25cf35c062a57082df6ea1d7e319dbc55f55048f..3940af48563a87bbfebb3eb1cc2f1174289a051a 100644 (file)
@@ -554,7 +554,8 @@ M: integer end-of-year 12 31 <date> ;
 : unix-time>timestamp ( seconds -- timestamp )
     seconds unix-1970 time+ ;
 
-M: duration sleep duration>nanoseconds nano-count + sleep-until ;
+M: duration sleep
+    duration>nanoseconds >integer nano-count + sleep-until ;
 
 {
     { [ os unix? ] [ "calendar.unix" ] }
index 79aad20b856b0e875dbdf222b96b43b530b7de37..f9196e295186e23f49012eb73376d09929dcc905 100644 (file)
@@ -1,6 +1,6 @@
 USING: namespaces io tools.test threads kernel
 concurrency.combinators concurrency.promises locals math
-words ;
+words calendar ;
 IN: threads.tests
 
 3 "x" set
@@ -42,3 +42,5 @@ yield
 [ t ] [ spawn-namespace-test ] unit-test
 
 [ "a" [ 1 1 + ] spawn 100 sleep ] must-fail
+
+[ ] [ 0.1 seconds sleep ] unit-test