diff options
| -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 4715e64cd..dac232ad2 100644 --- a/src/lib_os.c +++ b/src/lib_os.c | |||
| @@ -224,6 +224,7 @@ LJLIB_CF(os_date) | |||
| 224 | LJLIB_CF(os_time) | 224 | LJLIB_CF(os_time) |
| 225 | { | 225 | { |
| 226 | time_t t; | 226 | time_t t; |
| 227 | errno = 0; | ||
| 227 | if (lua_isnoneornil(L, 1)) { /* called without args? */ | 228 | if (lua_isnoneornil(L, 1)) { /* called without args? */ |
| 228 | t = time(NULL); /* get current time */ | 229 | t = time(NULL); /* get current time */ |
| 229 | } else { | 230 | } else { |
| @@ -237,7 +238,6 @@ LJLIB_CF(os_time) | |||
| 237 | ts.tm_mon = (int)((unsigned int)getfield(L, "month", -1) - 1u); | 238 | ts.tm_mon = (int)((unsigned int)getfield(L, "month", -1) - 1u); |
| 238 | ts.tm_year = (int)((unsigned int)getfield(L, "year", -1) - 1900u); | 239 | ts.tm_year = (int)((unsigned int)getfield(L, "year", -1) - 1900u); |
| 239 | ts.tm_isdst = getboolfield(L, "isdst"); | 240 | ts.tm_isdst = getboolfield(L, "isdst"); |
| 240 | errno = 0; | ||
| 241 | t = mktime(&ts); | 241 | t = mktime(&ts); |
| 242 | } | 242 | } |
| 243 | if (t == (time_t)(-1) && errno != 0) | 243 | if (t == (time_t)(-1) && errno != 0) |
