diff options
Diffstat (limited to 'src/lib_os.c')
| -rw-r--r-- | src/lib_os.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib_os.c b/src/lib_os.c index bf1749151..d91cb976e 100644 --- a/src/lib_os.c +++ b/src/lib_os.c | |||
| @@ -230,6 +230,7 @@ LJLIB_CF(os_date) | |||
| 230 | LJLIB_CF(os_time) | 230 | LJLIB_CF(os_time) |
| 231 | { | 231 | { |
| 232 | time_t t; | 232 | time_t t; |
| 233 | errno = 0; | ||
| 233 | if (lua_isnoneornil(L, 1)) { /* called without args? */ | 234 | if (lua_isnoneornil(L, 1)) { /* called without args? */ |
| 234 | t = time(NULL); /* get current time */ | 235 | t = time(NULL); /* get current time */ |
| 235 | } else { | 236 | } else { |
| @@ -243,7 +244,6 @@ LJLIB_CF(os_time) | |||
| 243 | ts.tm_mon = (int)((unsigned int)getfield(L, "month", -1) - 1u); | 244 | ts.tm_mon = (int)((unsigned int)getfield(L, "month", -1) - 1u); |
| 244 | ts.tm_year = (int)((unsigned int)getfield(L, "year", -1) - 1900u); | 245 | ts.tm_year = (int)((unsigned int)getfield(L, "year", -1) - 1900u); |
| 245 | ts.tm_isdst = getboolfield(L, "isdst"); | 246 | ts.tm_isdst = getboolfield(L, "isdst"); |
| 246 | errno = 0; | ||
| 247 | t = mktime(&ts); | 247 | t = mktime(&ts); |
| 248 | } | 248 | } |
| 249 | if (t == (time_t)(-1) && errno != 0) | 249 | if (t == (time_t)(-1) && errno != 0) |
