summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-07-15 07:59:59 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-07-15 07:59:59 +0000
commit86307f52ee1b3c5aa76e2fd6ee118e681dd76905 (patch)
tree4f5675ce901200d4245c6697d4e8d1c224949174 /time.c
parente12510c502a3c8a81aeda66d1867eb1e760ce533 (diff)
990715
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/time.c b/time.c
index 113f34cccbc..dc295a7ed79 100644
--- a/time.c
+++ b/time.c
@@ -101,7 +101,7 @@ rb_time_new(sec, usec)
}
struct timeval
-rb_time_timeval(time)
+rb_time_interval(time)
VALUE time;
{
struct time_object *tobj;
@@ -130,17 +130,28 @@ rb_time_timeval(time)
break;
default:
- if (!rb_obj_is_kind_of(time, rb_cTime)) {
- rb_raise(rb_eTypeError, "can't convert %s into Time",
- rb_class2name(CLASS_OF(time)));
- }
- GetTimeval(time, tobj);
- t = tobj->tv;
+ rb_raise(rb_eTypeError, "can't convert %s into Time interval",
+ rb_class2name(CLASS_OF(time)));
break;
}
return t;
}
+struct timeval
+rb_time_timeval(time)
+ VALUE time;
+{
+ struct time_object *tobj;
+ struct timeval t;
+
+ if (rb_obj_is_kind_of(time, rb_cTime)) {
+ GetTimeval(time, tobj);
+ t = tobj->tv;
+ return t;
+ }
+ return rb_time_interval(time);
+}
+
static VALUE
time_s_at(klass, time)
VALUE klass, time;