diff options
Diffstat (limited to 'system-linux.c')
-rw-r--r-- | system-linux.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/system-linux.c b/system-linux.c index 9f1aa9e..aba603f 100644 --- a/system-linux.c +++ b/system-linux.c @@ -1,6 +1,7 @@ #include <sys/socket.h> #include <sys/ioctl.h> #include <sys/stat.h> +#include <sys/syscall.h> #include <linux/rtnetlink.h> #include <linux/sockios.h> @@ -395,3 +396,17 @@ int system_del_route(struct device *dev, struct device_route *route) { return system_rt(dev, route, RTM_DELROUTE); } + +time_t system_get_rtime(void) +{ + struct timespec ts; + struct timeval tv; + + if (syscall(__NR_clock_gettime, CLOCK_MONOTONIC, &ts) == 0) + return ts.tv_sec; + + if (gettimeofday(&tv, NULL) == 0) + return tv.tv_sec; + + return 0; +} |