ref: e3416eb824cd27301c3f8a432efd52b77c10abf1
parent: 1661838889c6586f04d8add58654df1f5a85eb99
author: kvik <kvik@a-b.xyz>
date: Thu Feb 18 14:05:46 EST 2021
os9lib: remove timestamp range check The timestamp type (time_t) is always an integral value on Plan 9, so the check for NaN / Infinity is pointless.
--- a/los9lib.c
+++ b/los9lib.c
@@ -239,19 +239,11 @@
return 1;
}
-static vlong
-l_checktime(lua_State *L, int arg)
-{- vlong t = luaL_checkinteger(L, arg);
- luaL_argcheck(L, (vlong)t == t, arg, "time out-of-bounds");
- return t;
-}
-
static int
os_difftime(lua_State *L)
{- vlong t1 = l_checktime(L, 1);
- vlong t2 = l_checktime(L, 2);
+ vlong t1 = luaL_checkinteger(L, 1);
+ vlong t2 = luaL_checkinteger(L, 2);
lua_pushnumber(L, (lua_Number)(t1 - t2));
return 1;
}
@@ -335,7 +327,7 @@
Tm tm, *tp;
s = luaL_optstring(L, 1, "%c");
- t = luaL_opt(L, l_checktime, 2, time(nil));
+ t = luaL_opt(L, luaL_checkinteger, 2, time(nil));
if(s[0] == '!'){tp = gmtime(t);
s++;
@@ -369,10 +361,10 @@
{"rename", os_rename}, {"tmpname", os_tmpname}, {"clock", os_clock},- {"date", os_date},- {"time", os_time},- {"difftime", os_difftime},- {"setlocale", os_setlocale},+ {"date", os_date},+ {"time", os_time},+ {"difftime", os_difftime},+ {"setlocale", os_setlocale}, {nil, nil}};
--
⑨