diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-08-02 21:53:23 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-08-02 21:53:23 +0900 |
| commit | cc0f249c17a68eaa5e016638b465c2087b983148 (patch) | |
| tree | 27f8d15942f97b64adc5f6045e125a0107131b41 /src/time.c | |
| parent | a7f0e3bc8081f30bbcfe0058824a4edae7ea7af4 (diff) | |
| download | mruby-cc0f249c17a68eaa5e016638b465c2087b983148.tar.gz mruby-cc0f249c17a68eaa5e016638b465c2087b983148.zip | |
Time.new may not take any argument
Diffstat (limited to 'src/time.c')
| -rw-r--r-- | src/time.c | 8 |
1 files changed, 5 insertions, 3 deletions
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; |
