make secs time_t in otr_strftime()

closes #375
This commit is contained in:
Jan-Piet Mens
2022-02-05 13:50:44 +01:00
parent dff2e87d1b
commit 9862d5dd2e

View File

@@ -520,13 +520,13 @@ static int otr_log(lua_State *lua)
static int otr_strftime(lua_State *lua)
{
const char *fmt;
long secs;
time_t secs;
struct tm *tm;
char buf[BUFSIZ];
if (lua_gettop(lua) >= 1) {
fmt = lua_tostring(lua, 1);
if ((secs = lua_tonumber(lua, 2)) < 1)
if ((secs = (time_t)lua_tonumber(lua, 2)) < 1)
secs = time(0);
if ((tm = gmtime(&secs)) != NULL) {