diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2002-11-08 07:20:05 (GMT) |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2002-11-08 07:20:05 (GMT) |
commit | 1c4dd10d70ba9ed6dead6cc56cd0f572627cf619 (patch) | |
tree | 62485f23a5478eb8a6ad6b2de1eac322bf195662 /plugins/utils.c | |
parent | 34ba941736b434a6c1453feec35d04ed7b0a59e5 (diff) | |
download | monitoring-plugins-1c4dd10d70ba9ed6dead6cc56cd0f572627cf619.tar.gz |
patches required to build on solaris with asprintf and gettimeofday
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@174 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/utils.c')
-rw-r--r-- | plugins/utils.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/plugins/utils.c b/plugins/utils.c index a4519f2..bf1d204 100644 --- a/plugins/utils.c +++ b/plugins/utils.c | |||
@@ -44,6 +44,8 @@ int is_percentage (char *); | |||
44 | 44 | ||
45 | int is_option (char *str); | 45 | int is_option (char *str); |
46 | 46 | ||
47 | double delta_time (struct timeval tv); | ||
48 | |||
47 | void strip (char *); | 49 | void strip (char *); |
48 | char *strscpy (char *dest, const char *src); | 50 | char *strscpy (char *dest, const char *src); |
49 | char *strscat (char *dest, const char *src); | 51 | char *strscat (char *dest, const char *src); |
@@ -315,13 +317,21 @@ is_option (char *str) | |||
315 | 317 | ||
316 | 318 | ||
317 | 319 | ||
320 | #ifndef HAVE_GETTIMEOFDAY | ||
321 | int | ||
322 | gettimeofday (struct timeval *tv, struct timezone *tz) | ||
323 | { | ||
324 | tv->tv_usec = 0; | ||
325 | tv->tv_sec = (long) time ((time_t) 0); | ||
326 | } | ||
327 | #endif | ||
328 | |||
329 | |||
318 | 330 | ||
319 | double | 331 | double |
320 | delta_time (struct timeval tv) | 332 | delta_time (struct timeval tv) |
321 | { | 333 | { |
322 | struct timeval now; | 334 | struct timeval now; |
323 | struct timezone tz; | ||
324 | double et; | ||
325 | 335 | ||
326 | gettimeofday (&now, NULL); | 336 | gettimeofday (&now, NULL); |
327 | return ((double)(now.tv_sec - tv.tv_sec) + (double)(now.tv_usec - tv.tv_usec) / (double)1000000); | 337 | return ((double)(now.tv_sec - tv.tv_sec) + (double)(now.tv_usec - tv.tv_usec) / (double)1000000); |
@@ -366,8 +376,6 @@ strip (char *buffer) | |||
366 | char * | 376 | char * |
367 | strscpy (char *dest, const char *src) | 377 | strscpy (char *dest, const char *src) |
368 | { | 378 | { |
369 | size_t len; | ||
370 | |||
371 | if (src == NULL) | 379 | if (src == NULL) |
372 | return NULL; | 380 | return NULL; |
373 | 381 | ||