aboutsummaryrefslogtreecommitdiff
path: root/loslib.c
diff options
context:
space:
mode:
Diffstat (limited to 'loslib.c')
-rw-r--r--loslib.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/loslib.c b/loslib.c
index 39430419..22f9ea43 100644
--- a/loslib.c
+++ b/loslib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: loslib.c,v 1.39 2012/05/23 15:37:09 roberto Exp roberto $ 2** $Id: loslib.c,v 1.40 2012/10/19 15:54:02 roberto Exp roberto $
3** Standard Operating System library 3** Standard Operating System library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -194,7 +194,7 @@ static const char *checkoption (lua_State *L, const char *conv, char *buff) {
194 194
195static int os_date (lua_State *L) { 195static int os_date (lua_State *L) {
196 const char *s = luaL_optstring(L, 1, "%c"); 196 const char *s = luaL_optstring(L, 1, "%c");
197 time_t t = luaL_opt(L, (time_t)luaL_checknumber, 2, time(NULL)); 197 time_t t = luaL_opt(L, (time_t)luaL_checkinteger, 2, time(NULL));
198 struct tm tmr, *stm; 198 struct tm tmr, *stm;
199 if (*s == '!') { /* UTC? */ 199 if (*s == '!') { /* UTC? */
200 stm = l_gmtime(&t, &tmr); 200 stm = l_gmtime(&t, &tmr);
@@ -258,14 +258,14 @@ static int os_time (lua_State *L) {
258 if (t == (time_t)(-1)) 258 if (t == (time_t)(-1))
259 lua_pushnil(L); 259 lua_pushnil(L);
260 else 260 else
261 lua_pushnumber(L, (lua_Number)t); 261 lua_pushinteger(L, t);
262 return 1; 262 return 1;
263} 263}
264 264
265 265
266static int os_difftime (lua_State *L) { 266static int os_difftime (lua_State *L) {
267 lua_pushnumber(L, difftime((time_t)(luaL_checknumber(L, 1)), 267 lua_pushnumber(L, difftime((time_t)(luaL_checkinteger(L, 1)),
268 (time_t)(luaL_optnumber(L, 2, 0)))); 268 (time_t)(luaL_optinteger(L, 2, 0))));
269 return 1; 269 return 1;
270} 270}
271 271