1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* time.c (time_timespec): use NUM2TIMET.

(time_s_at): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2009-03-23 13:02:12 +00:00
parent 8d31e44620
commit 4a0bb2dc48
2 changed files with 9 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Mon Mar 23 22:01:00 2009 Tanaka Akira <akr@fsij.org>
* time.c (time_timespec): use NUM2TIMET.
(time_s_at): ditto.
Mon Mar 23 21:52:26 2009 Akinori MUSHA <knu@iDaemons.org>
* process.c (Init_process): Better patch for eliminating an

8
time.c
View file

@ -192,7 +192,7 @@ time_timespec(VALUE num, int interval)
switch (TYPE(num)) {
case T_FIXNUM:
t.tv_sec = FIX2LONG(num);
t.tv_sec = NUM2TIMET(num);
if (interval && t.tv_sec < 0)
rb_raise(rb_eArgError, "%s must be positive", tstr);
t.tv_nsec = 0;
@ -218,7 +218,7 @@ time_timespec(VALUE num, int interval)
break;
case T_BIGNUM:
t.tv_sec = NUM2LONG(num);
t.tv_sec = NUM2TIMET(num);
if (interval && t.tv_sec < 0)
rb_raise(rb_eArgError, "%s must be positive", tstr);
t.tv_nsec = 0;
@ -232,7 +232,7 @@ time_timespec(VALUE num, int interval)
}
i = rb_ary_entry(ary, 0);
f = rb_ary_entry(ary, 1);
t.tv_sec = NUM2LONG(i);
t.tv_sec = NUM2TIMET(i);
if (interval && t.tv_sec < 0)
rb_raise(rb_eArgError, "%s must be positive", tstr);
f = rb_funcall(f, id_mul, 1, INT2FIX(1000000000));
@ -324,7 +324,7 @@ time_s_at(int argc, VALUE *argv, VALUE klass)
VALUE time, t;
if (rb_scan_args(argc, argv, "11", &time, &t) == 2) {
ts.tv_sec = NUM2LONG(time);
ts.tv_sec = NUM2TIMET(time);
ts.tv_nsec = NUM2LONG(rb_funcall(t, id_mul, 1, INT2FIX(1000)));
}
else {