diff options
author | chai <chaifix@163.com> | 2018-07-28 22:10:27 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-07-28 22:10:27 +0800 |
commit | 52693d68f7181d707e1a192d67a617145b358394 (patch) | |
tree | 5a39bcdf225def306738ead6683cd224e2c5762d /src/lua/time/luaopen_time.cpp | |
parent | d033400614e7e2c0ff49e5100c81e937e5818e74 (diff) |
*update
Diffstat (limited to 'src/lua/time/luaopen_time.cpp')
-rw-r--r-- | src/lua/time/luaopen_time.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lua/time/luaopen_time.cpp b/src/lua/time/luaopen_time.cpp index 370d868..4ef5372 100644 --- a/src/lua/time/luaopen_time.cpp +++ b/src/lua/time/luaopen_time.cpp @@ -1,20 +1,24 @@ #include "lua/luax.h" #include <SDL2/SDL.h> +#include "libjin/jin.h" + namespace jin { namespace lua { + using namespace jin::time; + static int l_sec(lua_State* L) { - luax_pushnumber(L, SDL_GetTicks()/1000.f); + luax_pushnumber(L, getSecond()); return 1; } static int l_sleep(lua_State* L) { double sec = luax_checknumber(L, 1); - SDL_Delay(sec * 1000); + sleep(sec * 1000.0f); return 0; } |