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:
cremno
2014-04-13 16:43:13 +02:00
parent 8b5cbe2f33
commit 06a946abb2
+1 -1
View File
@@ -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.");
}