diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib_os.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib_os.c b/src/lib_os.c index 60b7b82d6..4715e64cd 100644 --- a/src/lib_os.c +++ b/src/lib_os.c | |||
| @@ -237,9 +237,10 @@ LJLIB_CF(os_time) | |||
| 237 | ts.tm_mon = (int)((unsigned int)getfield(L, "month", -1) - 1u); | 237 | ts.tm_mon = (int)((unsigned int)getfield(L, "month", -1) - 1u); |
| 238 | ts.tm_year = (int)((unsigned int)getfield(L, "year", -1) - 1900u); | 238 | ts.tm_year = (int)((unsigned int)getfield(L, "year", -1) - 1900u); |
| 239 | ts.tm_isdst = getboolfield(L, "isdst"); | 239 | ts.tm_isdst = getboolfield(L, "isdst"); |
| 240 | errno = 0; | ||
| 240 | t = mktime(&ts); | 241 | t = mktime(&ts); |
| 241 | } | 242 | } |
| 242 | if (t == (time_t)(-1)) | 243 | if (t == (time_t)(-1) && errno != 0) |
| 243 | lua_pushnil(L); | 244 | lua_pushnil(L); |
| 244 | else | 245 | else |
| 245 | lua_pushnumber(L, (lua_Number)t); | 246 | lua_pushnumber(L, (lua_Number)t); |
