openwrt: add 120-add_gettimeofday.patch to luci/patches
This commit is contained in:
parent
0dc94a5994
commit
619b6e0436
|
@ -0,0 +1,23 @@
|
|||
--- a/libs/nixio/src/poll.c (revision 4437)
|
||||
+++ b/libs/nixio/src/poll.c (revision 6182)
|
||||
@@ -22,4 +22,14 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
+#include <sys/time.h>
|
||||
+
|
||||
+
|
||||
+static int nixio_gettimeofday(lua_State *L) {
|
||||
+ struct timeval tv;
|
||||
+ gettimeofday(&tv, NULL);
|
||||
+ nixio__pushnumber(L, tv.tv_sec);
|
||||
+ nixio__pushnumber(L, tv.tv_usec);
|
||||
+ return 2;
|
||||
+}
|
||||
|
||||
|
||||
@@ -189,4 +199,5 @@
|
||||
/* module table */
|
||||
static const luaL_reg R[] = {
|
||||
+ {"gettimeofday", nixio_gettimeofday},
|
||||
{"nanosleep", nixio_nanosleep},
|
||||
{"poll", nixio_poll},
|
Loading…
Reference in New Issue