From eb47d0870a7901a5e6304686e0defee4287d66bc Mon Sep 17 00:00:00 2001 From: Karl DeBisschop Date: Sat, 9 Aug 2003 04:12:14 +0000 Subject: add function for elapsed tim ein microseconds git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@670 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/utils.c | 10 ++++++++++ plugins/utils.h | 1 + 2 files changed, 11 insertions(+) diff --git a/plugins/utils.c b/plugins/utils.c index c2261dc3..518caa8c 100644 --- a/plugins/utils.c +++ b/plugins/utils.c @@ -287,6 +287,16 @@ delta_time (struct timeval tv) +long +deltime (struct timeval tv) +{ + struct timeval now; + gettimeofday (&now, NULL); + return (now.tv_sec - tv.tv_sec)*1000000 + now.tv_usec - tv.tv_usec; +} + + + void strip (char *buffer) diff --git a/plugins/utils.h b/plugins/utils.h index c378e459..b763b1e2 100644 --- a/plugins/utils.h +++ b/plugins/utils.h @@ -59,6 +59,7 @@ int gettimeofday(struct timeval *tv, struct timezone *tz); #endif double delta_time (struct timeval tv); +long deltime (struct timeval tv); /* Handle strings safely */ -- cgit v1.2.3-74-g34f1