From cc0f249c17a68eaa5e016638b465c2087b983148 Mon Sep 17 00:00:00 2001 From: Yukihiro Matsumoto Date: Thu, 2 Aug 2012 21:53:23 +0900 Subject: Time.new may not take any argument --- src/time.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/time.c b/src/time.c index 272402bd7..ac04745e5 100644 --- a/src/time.c +++ b/src/time.c @@ -522,18 +522,20 @@ mrb_time_initialize(mrb_state *mrb, mrb_value self) { mrb_int ayear = 0, amonth = 1, aday = 1, ahour = 0, amin = 0, asec = 0, ausec = 0; + int n; struct mrb_time *tm; tm = (struct mrb_time *)mrb_get_datatype(mrb, self, &mrb_time_type); if (tm) { mrb_time_free(mrb, tm); } - if (mrb->ci->argc == 0) { + + n = mrb_get_args(mrb, "|iiiiiii", + &ayear, &amonth, &aday, &ahour, &amin, &asec, &ausec); + if (n == 0) { tm = current_mrb_time(mrb); } else { - mrb_get_args(mrb, "iiiiiii", - &ayear, &amonth, &aday, &ahour, &amin, &asec, &ausec); tm = time_mktime(mrb, ayear, amonth, aday, ahour, amin, asec, ausec, MRB_TIMEZONE_LOCAL); } DATA_PTR(self) = tm; -- cgit v1.2.3