usock: fix poll return code check
[project/libubox.git] / uloop.c
diff --git a/uloop.c b/uloop.c
index 769b6c580711257923cd8b960c9376365ec55fee..0134fa4f21f55688c1c9a04d05b3afb5e55a1072 100644 (file)
--- a/uloop.c
+++ b/uloop.c
@@ -338,6 +338,18 @@ int uloop_timeout_remaining(struct uloop_timeout *timeout)
                return (int)td;
 }
 
+int64_t uloop_timeout_remaining64(struct uloop_timeout *timeout)
+{
+       struct timeval now;
+
+       if (!timeout->pending)
+               return -1;
+
+       uloop_gettime(&now);
+
+       return tv_diff(&timeout->time, &now);
+}
+
 int uloop_process_add(struct uloop_process *p)
 {
        struct uloop_process *tmp;