Skip to content

Commit

Permalink
NX: fixing os.time() for NX platform (#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
bakeinflash authored Jul 24, 2022
1 parent 8909f64 commit 008bf38
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions external/lua-5.1.3/src/loslib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 008bf38

Please sign in to comment.