summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-10-29 09:25:48 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-10-29 09:25:48 +0000
commit0d684beafb4258da9606b1e3b4448511b709a2e2 (patch)
tree4a0007dc6a1e7e8ae71ad40000b9ba56332dbaf2 /time.c
parentcd2af215d4d438bcb217ffce94c208e229dfe58a (diff)
19991029
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/time.c b/time.c
index dd22c49..4d18827 100644
--- a/time.c
+++ b/time.c
@@ -152,13 +152,21 @@ rb_time_timeval(time)
}
static VALUE
-time_s_at(klass, time)
- VALUE klass, time;
+time_s_at(argc, argv, klass)
+ int argc;
+ VALUE *argv;
+ VALUE klass;
{
struct timeval tv;
- VALUE t;
+ VALUE time, t;
- tv = rb_time_timeval(time);
+ if (rb_scan_args(argc, argv, "11", &time, &t) == 2) {
+ tv.tv_sec = NUM2INT(time);
+ tv.tv_usec = NUM2INT(t);
+ }
+ else {
+ tv = rb_time_timeval(time);
+ }
t = time_new_internal(klass, tv.tv_sec, tv.tv_usec);
if (TYPE(time) == T_DATA) {
struct time_object *tobj, *tobj2;
@@ -978,7 +986,7 @@ Init_Time()
rb_define_singleton_method(rb_cTime, "now", time_s_now, 0);
rb_define_singleton_method(rb_cTime, "new", time_s_now, 0);
- rb_define_singleton_method(rb_cTime, "at", time_s_at, 1);
+ rb_define_singleton_method(rb_cTime, "at", time_s_at, -1);
rb_define_singleton_method(rb_cTime, "gm", time_s_timegm, -1);
rb_define_singleton_method(rb_cTime, "local", time_s_timelocal, -1);
rb_define_singleton_method(rb_cTime, "mktime", time_s_timelocal, -1);