[macruby-changes] [3139] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Dec 18 17:50:51 PST 2009


Revision: 3139
          http://trac.macosforge.org/projects/ruby/changeset/3139
Author:   ernest.prabhakar at gmail.com
Date:     2009-12-18 17:50:51 -0800 (Fri, 18 Dec 2009)
Log Message:
-----------
Changed QueueDispatch::Queue after to use new time macros/functions

Modified Paths:
--------------
    MacRuby/trunk/gcd.c
    MacRuby/trunk/spec/macruby/tags/macruby/core/gcd/queue_tags.txt

Modified: MacRuby/trunk/gcd.c
===================================================================
--- MacRuby/trunk/gcd.c	2009-12-19 01:49:41 UTC (rev 3138)
+++ MacRuby/trunk/gcd.c	2009-12-19 01:50:51 UTC (rev 3139)
@@ -135,8 +135,8 @@
     }
 }
 
-#define SEC2NSEC_UINT64(sec) (uint64_t)((sec) * NSEC_PER_SEC)
-#define SEC2NSEC_INT64(sec) (int64_t)((sec) * NSEC_PER_SEC)
+#define SEC2NSEC_UINT64(sec) (uint64_t)(sec * NSEC_PER_SEC)
+#define SEC2NSEC_INT64(sec) (int64_t)(sec * NSEC_PER_SEC)
 #define TIMEOUT_MAX (1.0 * INT64_MAX / NSEC_PER_SEC)
 
 static inline uint64_t
@@ -432,15 +432,10 @@
  *     gcdq.after(0.5) { puts 'wait is over :)' }
  *
  */
-// TODO: there is a max value that can be passed (int64_max / NSEC_PER_SEC);
-// adjust for this.
 static VALUE
 rb_queue_dispatch_after(VALUE self, SEL sel, VALUE sec)
 {
-    sec = rb_Float(sec);
-    dispatch_time_t offset = dispatch_walltime(NULL,
-	    (int64_t)(RFLOAT_VALUE(sec) * NSEC_PER_SEC));
-
+    dispatch_time_t offset = rb_num2timeout(sec);
     rb_vm_block_t *block = given_block();
     block = rb_dispatch_prepare_block(block);
 

Modified: MacRuby/trunk/spec/macruby/tags/macruby/core/gcd/queue_tags.txt
===================================================================
--- MacRuby/trunk/spec/macruby/tags/macruby/core/gcd/queue_tags.txt	2009-12-19 01:49:41 UTC (rev 3138)
+++ MacRuby/trunk/spec/macruby/tags/macruby/core/gcd/queue_tags.txt	2009-12-19 01:50:51 UTC (rev 3139)
@@ -1,2 +1,3 @@
 critical:Dispatch::Queue new raises an ArgumentError if not passed a string
+critical:Dispatch::Queue after raises an ArgumentError if no time is given
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091218/0b96a67a/attachment.html>


More information about the macruby-changes mailing list