diff options
| author | cremno <[email protected]> | 2014-04-13 16:43:13 +0200 |
|---|---|---|
| committer | cremno <[email protected]> | 2014-04-13 16:43:13 +0200 |
| commit | 06a946abb2ee0f23bb48a3841d9b95c0e76c3467 (patch) | |
| tree | 9cab68ef14659ee5e20e076baa25b603957936c9 | |
| parent | 8b5cbe2f33bd1e50eeb0174fcbe71e0efd710b28 (diff) | |
| download | mruby-06a946abb2ee0f23bb48a3841d9b95c0e76c3467.tar.gz mruby-06a946abb2ee0f23bb48a3841d9b95c0e76c3467.zip | |
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
| -rw-r--r-- | mrbgems/mruby-time/src/time.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c index 076946123..1ffab9ae6 100644 --- a/mrbgems/mruby-time/src/time.c +++ b/mrbgems/mruby-time/src/time.c @@ -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."); } |
