aboutsummaryrefslogtreecommitdiff
path: root/src/timeout.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/timeout.c')
-rw-r--r--src/timeout.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/timeout.c b/src/timeout.c
index 50a84da..5549c89 100644
--- a/src/timeout.c
+++ b/src/timeout.c
@@ -1,5 +1,10 @@
1/*=========================================================================*\ 1/*=========================================================================*\
2* Timeout management functions 2* Timeout management functions
3* Global Lua functions:
4* _sleep: (debug mode only)
5* _time: (debug mode only)
6*
7* RCS ID: $Id$
3\*=========================================================================*/ 8\*=========================================================================*/
4#include <lua.h> 9#include <lua.h>
5#include <lauxlib.h> 10#include <lauxlib.h>
@@ -20,10 +25,8 @@
20/*=========================================================================*\ 25/*=========================================================================*\
21* Internal function prototypes 26* Internal function prototypes
22\*=========================================================================*/ 27\*=========================================================================*/
23#ifdef LUASOCKET_DEBUG
24static int tm_lua_time(lua_State *L); 28static int tm_lua_time(lua_State *L);
25static int tm_lua_sleep(lua_State *L); 29static int tm_lua_sleep(lua_State *L);
26#endif
27 30
28/*=========================================================================*\ 31/*=========================================================================*\
29* Exported functions. 32* Exported functions.
@@ -123,12 +126,10 @@ int tm_gettime(void)
123void tm_open(lua_State *L) 126void tm_open(lua_State *L)
124{ 127{
125 (void) L; 128 (void) L;
126#ifdef LUASOCKET_DEBUG
127 lua_pushcfunction(L, tm_lua_time); 129 lua_pushcfunction(L, tm_lua_time);
128 priv_newglobal(L, "_time"); 130 priv_newglobal(L, "_time");
129 lua_pushcfunction(L, tm_lua_sleep); 131 lua_pushcfunction(L, tm_lua_sleep);
130 priv_newglobal(L, "_sleep"); 132 priv_newglobal(L, "_sleep");
131#endif
132} 133}
133 134
134/*=========================================================================*\ 135/*=========================================================================*\
@@ -137,7 +138,6 @@ void tm_open(lua_State *L)
137/*-------------------------------------------------------------------------*\ 138/*-------------------------------------------------------------------------*\
138* Returns the time the system has been up, in secconds. 139* Returns the time the system has been up, in secconds.
139\*-------------------------------------------------------------------------*/ 140\*-------------------------------------------------------------------------*/
140#ifdef LUASOCKET_DEBUG
141static int tm_lua_time(lua_State *L) 141static int tm_lua_time(lua_State *L)
142{ 142{
143 lua_pushnumber(L, tm_gettime()/1000.0); 143 lua_pushnumber(L, tm_gettime()/1000.0);
@@ -157,4 +157,3 @@ int tm_lua_sleep(lua_State *L)
157#endif 157#endif
158 return 0; 158 return 0;
159} 159}
160#endif