summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
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 113f34cccb..dc295a7ed7 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;