commit 1c892f0e6220ae5a6a086bd811ec26e6bda4337c
Author: Bruno Randolf <b...@einfach.org>
Date:   Tue Jul 13 21:05:09 2010 +0900

    lua: fix os_date with LNUM
    
    this fixes the LNUMP patch for lua. without it os.date can return a wrong
    date or time, due to precision loss in the integer - float conversion.

diff --git a/package/lua/Makefile b/package/lua/Makefile
index 0a5e8f3..fdbbddc 100644
--- a/package/lua/Makefile
+++ b/package/lua/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=lua
 PKG_VERSION:=5.1.4
-PKG_RELEASE:=6
+PKG_RELEASE:=7
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.lua.org/ftp/ \
diff --git a/package/lua/patches/016-lnum-date-fix.patch 
b/package/lua/patches/016-lnum-date-fix.patch
new file mode 100644
index 0000000..a807198
--- /dev/null
+++ b/package/lua/patches/016-lnum-date-fix.patch
@@ -0,0 +1,15 @@
+diff -Nurb lua-5.1.4/src/loslib.c lua-5.1.4.mod/src/loslib.c
+--- lua-5.1.4/src/loslib.c     2010-07-13 20:46:24.989091058 +0900
++++ lua-5.1.4.mod/src/loslib.c 2010-07-13 20:47:42.637840266 +0900
+@@ -123,7 +123,11 @@
+ 
+ static int os_date (lua_State *L) {
+   const char *s = luaL_optstring(L, 1, "%c");
++#ifdef LNUM_FLOAT
++  time_t t = luaL_opt(L, (time_t)luaL_checkinteger, 2, time(NULL));
++#else
+   time_t t = luaL_opt(L, (time_t)luaL_checknumber, 2, time(NULL));
++#endif
+   struct tm *stm;
+   if (*s == '!') {  /* UTC? */
+     stm = gmtime(&t);
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to