mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-time: fix check of mktime's return value
>If the calendar time cannot be represented, the function returns the value (time_t)(-1). http://www.iso-9899.info/n1256.html#7.23.2.3p3
This commit is contained in:
@@ -293,7 +293,7 @@ time_mktime(mrb_state *mrb, mrb_int ayear, mrb_int amonth, mrb_int aday,
|
||||
else {
|
||||
nowsecs = mktime(&nowtime);
|
||||
}
|
||||
if (nowsecs < 0) {
|
||||
if (nowsecs == (time_t)-1) {
|
||||
mrb_raise(mrb, E_ARGUMENT_ERROR, "Not a valid time.");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user