From 008bf385b7a36a083473f59600edd9b4b73f089b Mon Sep 17 00:00:00 2001 From: vitaly Date: Sun, 24 Jul 2022 20:49:12 +0300 Subject: [PATCH] NX: fixing os.time() for NX platform (#428) --- external/lua-5.1.3/src/loslib.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/external/lua-5.1.3/src/loslib.c b/external/lua-5.1.3/src/loslib.c index 0c0ad1cf4..e91c56c10 100644 --- a/external/lua-5.1.3/src/loslib.c +++ b/external/lua-5.1.3/src/loslib.c @@ -19,6 +19,9 @@ #include "lauxlib.h" #include "lualib.h" +#ifdef NXS_LIB + struct tm* nx_localtime(const time_t* timep); +#endif static int os_pushresult (lua_State *L, int i, const char *filename) { int en = errno; /* calls to Lua API may change this value */ @@ -155,7 +158,13 @@ static int os_date (lua_State *L) { s++; /* skip `!' */ } else + +#ifdef NXS_LIB + stm = nx_localtime(&t); +#else stm = localtime(&t); +#endif + if (stm == NULL) /* invalid date? */ lua_pushnil(L); else if (strcmp(s, "*t") == 0) {