Skip to content

Commit

Permalink
NX: fixing os.time() (#605)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shchvova committed Aug 18, 2023
1 parent e3a62f7 commit d39da67
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion external/lua-5.1.3/src/loslib.c
Expand Up @@ -21,6 +21,7 @@

#ifdef NXS_LIB
struct tm* nx_localtime(const time_t* timep);
time_t nx_time(time_t* tloc);
#endif

static int os_pushresult (lua_State *L, int i, const char *filename) {
Expand Down Expand Up @@ -232,7 +233,11 @@ static int os_date (lua_State *L) {
static int os_time (lua_State *L) {
time_t t;
if (lua_isnoneornil(L, 1)) /* called without args? */
t = time(NULL); /* get current time */
#ifdef NXS_LIB
t = nx_time(NULL); /* get current time */
#else
t = time(NULL); /* get current time */
#endif
else {
struct tm ts;
luaL_checktype(L, 1, LUA_TTABLE);
Expand Down

0 comments on commit d39da67

Please sign in to comment.