summaryrefslogtreecommitdiffstats
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
commit9868574ae43c0fdc49a9d3fc0431bb0613507bfa (patch)
tree4a0007dc6a1e7e8ae71ad40000b9ba56332dbaf2 /time.c
parent419abc80a3b260936a5c1b92690a4885774b29c6 (diff)
downloadruby-9868574ae43c0fdc49a9d3fc0431bb0613507bfa.tar.gz
ruby-9868574ae43c0fdc49a9d3fc0431bb0613507bfa.tar.xz
ruby-9868574ae43c0fdc49a9d3fc0431bb0613507bfa.zip
19991029
git-svn-id: http://svn.ruby-lang.org/repos/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 dd22c499d..4d1882759 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);