aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2026-06-25 11:59:34 +0200
committerMike Pall <mike>2026-06-25 11:59:34 +0200
commit295d45fb26de56498782c94594f31b97aef744ef (patch)
treec17b8afa911e6bfb18e6b82bd1cc8ec43e1cd84c
parentd2c1327f57dc96f6ed8b11474f3bc5e09a9d227a (diff)
downloadluajit-295d45fb26de56498782c94594f31b97aef744ef.tar.gz
luajit-295d45fb26de56498782c94594f31b97aef744ef.tar.bz2
luajit-295d45fb26de56498782c94594f31b97aef744ef.zip
Make check in os.time() consistent.
Thanks to Temir Galeev. #1470
-rw-r--r--src/lib_os.c2
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)
224LJLIB_CF(os_time) 224LJLIB_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)