summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/time.c8
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;