]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: add function to get precise remaining time of timer thread
authorChristian Franke <chris@opensourcerouting.org>
Tue, 10 Nov 2015 17:04:41 +0000 (18:04 +0100)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 30 Mar 2016 00:26:26 +0000 (20:26 -0400)
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/thread.c
lib/thread.h

index c56a9ec5054e417a63eca07274ec997f9fcaafee..ab4764dfb1ef0004f0d858b8c10188f849d2230d 100644 (file)
@@ -766,6 +766,14 @@ strip_funcname (char *dest, const char *funcname)
   *e = tmp;
 }
 
+struct timeval
+thread_timer_remain(struct thread *thread)
+{
+  quagga_get_relative(NULL);
+
+  return timeval_subtract(thread->u.sands, relative_time);
+}
+
 /* Get new thread.  */
 static struct thread *
 thread_get (struct thread_master *m, u_char type,
index c8c8c1932359a6e7841bb4ff794c70ad445f3943..4ca1e3ce04efc72faf91cab7494f4c1a820152c9 100644 (file)
@@ -235,6 +235,7 @@ extern unsigned int thread_cancel_event (struct thread_master *, void *);
 extern struct thread *thread_fetch (struct thread_master *, struct thread *);
 extern void thread_call (struct thread *);
 extern unsigned long thread_timer_remain_second (struct thread *);
+extern struct timeval thread_timer_remain(struct thread*);
 extern int thread_should_yield (struct thread *);
 extern unsigned long timeval_elapsed (struct timeval a, struct timeval b);
 /* set yield time for thread */