diff options
author | Stijn Tintel <stijn@linux-ipv6.be> | 2021-11-04 13:26:41 +0300 |
---|---|---|
committer | Stijn Tintel <stijn@linux-ipv6.be> | 2021-11-04 14:05:24 +0300 |
commit | 3344157381505e343b334e2eb6c60c9d3318e5bb (patch) | |
tree | 74ca3e30aa81600f7d9e6e7da6caaf4fa9070f6c /uloop.c | |
parent | 123e976f3d012b310ac223a54b7ef5213107e33d (diff) |
uloop: add uloop_timeout_remaining64
This uses the same return type as tv_diff so we don't need to check for
integer overflow.
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Acked-by: Jo-Philipp Wich <jo@mein.io>
Acked-by: John Crispin <john@phrozen.org>
Diffstat (limited to 'uloop.c')
-rw-r--r-- | uloop.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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; |