diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-09 04:12:14 +0000 |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-09 04:12:14 +0000 |
commit | eb47d0870a7901a5e6304686e0defee4287d66bc (patch) | |
tree | fea41680f3280326c73db9752fa55b5c77d28488 | |
parent | e7c0f123ae3173995446e6b2c6e0b436db50667c (diff) | |
download | monitoring-plugins-eb47d0870a7901a5e6304686e0defee4287d66bc.tar.gz |
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
-rw-r--r-- | plugins/utils.c | 10 | ||||
-rw-r--r-- | plugins/utils.h | 1 |
2 files changed, 11 insertions, 0 deletions
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) | |||
287 | 287 | ||
288 | 288 | ||
289 | 289 | ||
290 | long | ||
291 | deltime (struct timeval tv) | ||
292 | { | ||
293 | struct timeval now; | ||
294 | gettimeofday (&now, NULL); | ||
295 | return (now.tv_sec - tv.tv_sec)*1000000 + now.tv_usec - tv.tv_usec; | ||
296 | } | ||
297 | |||
298 | |||
299 | |||
290 | 300 | ||
291 | void | 301 | void |
292 | strip (char *buffer) | 302 | 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); | |||
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | double delta_time (struct timeval tv); | 61 | double delta_time (struct timeval tv); |
62 | long deltime (struct timeval tv); | ||
62 | 63 | ||
63 | /* Handle strings safely */ | 64 | /* Handle strings safely */ |
64 | 65 | ||