aboutsummaryrefslogtreecommitdiff
path: root/src/lib_os.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib_os.c')
-rw-r--r--src/lib_os.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib_os.c b/src/lib_os.c
index 7821fc1fd..bf1749151 100644
--- a/src/lib_os.c
+++ b/src/lib_os.c
@@ -243,9 +243,10 @@ LJLIB_CF(os_time)
243 ts.tm_mon = (int)((unsigned int)getfield(L, "month", -1) - 1u); 243 ts.tm_mon = (int)((unsigned int)getfield(L, "month", -1) - 1u);
244 ts.tm_year = (int)((unsigned int)getfield(L, "year", -1) - 1900u); 244 ts.tm_year = (int)((unsigned int)getfield(L, "year", -1) - 1900u);
245 ts.tm_isdst = getboolfield(L, "isdst"); 245 ts.tm_isdst = getboolfield(L, "isdst");
246 errno = 0;
246 t = mktime(&ts); 247 t = mktime(&ts);
247 } 248 }
248 if (t == (time_t)(-1)) 249 if (t == (time_t)(-1) && errno != 0)
249 lua_pushnil(L); 250 lua_pushnil(L);
250 else 251 else
251 lua_pushnumber(L, (lua_Number)t); 252 lua_pushnumber(L, (lua_Number)t);