diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-05-20 19:21:35 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-05-20 19:21:35 -0300 |
commit | abc6eac404da8181ad945ac6950f61a65ba7dfa5 (patch) | |
tree | 6342898657f7dde13896fdfe3d5b9e6ef39d4d22 /liolib.c | |
parent | 054e0b888a45bc143b8e4cb7a6b77eba0350bb49 (diff) | |
download | lua-abc6eac404da8181ad945ac6950f61a65ba7dfa5.tar.gz lua-abc6eac404da8181ad945ac6950f61a65ba7dfa5.tar.bz2 lua-abc6eac404da8181ad945ac6950f61a65ba7dfa5.zip |
new function "clock"
Diffstat (limited to 'liolib.c')
-rw-r--r-- | liolib.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 1.16 1998/03/06 18:47:42 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 1.17 1998/03/24 20:14:25 roberto Exp roberto $ |
3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -282,6 +282,11 @@ static void io_getenv (void) | |||
282 | } | 282 | } |
283 | 283 | ||
284 | 284 | ||
285 | static void io_clock (void) { | ||
286 | lua_pushnumber(((double)clock())/CLOCKS_PER_SEC); | ||
287 | } | ||
288 | |||
289 | |||
285 | static void io_date (void) | 290 | static void io_date (void) |
286 | { | 291 | { |
287 | time_t t; | 292 | time_t t; |
@@ -378,6 +383,7 @@ static struct luaL_reg iolib[] = { | |||
378 | {"tmpname", io_tmpname}, | 383 | {"tmpname", io_tmpname}, |
379 | {"getenv", io_getenv}, | 384 | {"getenv", io_getenv}, |
380 | {"date", io_date}, | 385 | {"date", io_date}, |
386 | {"clock", io_clock}, | ||
381 | {"exit", io_exit}, | 387 | {"exit", io_exit}, |
382 | {"debug", io_debug}, | 388 | {"debug", io_debug}, |
383 | {"print_stack", errorfb} | 389 | {"print_stack", errorfb} |