time.c: `1969-12-31 23:59:59` is a valid time.
But `mktime(3)` for the date returns `-1` which happen to be the
error value.
MODIFY
mrbgems/mruby-time/src/time.c
mrbgems/mruby-time/src/time.c
@@ -483,8 +483,18 @@ time_mktime(mrb_state *mrb, mrb_int ayear, mrb_int amonth, mrb_int aday,
nowsecs = mktime(&nowtime);
}
if (nowsecs == (time_t)-1) {
+ nowtime.tm_sec += 1;
+ if (timezone == MRB_TIMEZONE_UTC) {
+ nowsecs = timegm(&nowtime);
+ }
+ else {
+ nowsecs = mktime(&nowtime);
+ }
+ if (nowsecs != 0) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "Not a valid time");
}
+ nowsecs = (time_t)-1;
+ }
return time_alloc_time(mrb, nowsecs, ausec, timezone);
}

MODIFY
mrbgems/mruby-time/test/time.rb
mrbgems/mruby-time/test/time.rb
@@ -267,7 +267,3 @@ assert('2000 times 500us make a second') do
end
assert_equal(0, t.usec)
end
-
-assert('Time.gm with Dec 31 23:59:59 1969 raise ArgumentError') do
- assert_raise(ArgumentError) {Time.gm(1969, 12, 31, 23, 59, 59)}
-end

time.c: `1969-12-31 23:59:59` is a valid time.

But `mktime(3)` for the date returns `-1` which happen to be the
error value.