lib: add function to get precise remaining time of timer thread

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
diff --git a/lib/thread.c b/lib/thread.c
index cb51332..5e40261 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -662,6 +662,14 @@
     return 0;
 }
 
+struct timeval
+thread_timer_remain(struct thread *thread)
+{
+  quagga_get_relative(NULL);
+
+  return timeval_subtract(thread->u.sands, relative_time);
+}
+
 #define debugargdef  const char *funcname, const char *schedfrom, int fromln
 #define debugargpass funcname, schedfrom, fromln