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>
This commit is contained in:
parent
123e976f3d
commit
3344157381
2 changed files with 13 additions and 0 deletions
12
uloop.c
12
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;
|
||||
|
|
1
uloop.h
1
uloop.h
|
@ -93,6 +93,7 @@ int uloop_timeout_add(struct uloop_timeout *timeout);
|
|||
int uloop_timeout_set(struct uloop_timeout *timeout, int msecs);
|
||||
int uloop_timeout_cancel(struct uloop_timeout *timeout);
|
||||
int uloop_timeout_remaining(struct uloop_timeout *timeout);
|
||||
int64_t uloop_timeout_remaining64(struct uloop_timeout *timeout);
|
||||
|
||||
int uloop_process_add(struct uloop_process *p);
|
||||
int uloop_process_delete(struct uloop_process *p);
|
||||
|
|
Loading…
Reference in a new issue