From 1c4dd10d70ba9ed6dead6cc56cd0f572627cf619 Mon Sep 17 00:00:00 2001 From: Karl DeBisschop Date: Fri, 8 Nov 2002 07:20:05 +0000 Subject: 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 --- plugins/utils.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'plugins/utils.c') diff --git a/plugins/utils.c b/plugins/utils.c index a4519f25..bf1d2047 100644 --- a/plugins/utils.c +++ b/plugins/utils.c @@ -44,6 +44,8 @@ int is_percentage (char *); int is_option (char *str); +double delta_time (struct timeval tv); + void strip (char *); char *strscpy (char *dest, const char *src); char *strscat (char *dest, const char *src); @@ -315,13 +317,21 @@ is_option (char *str) +#ifndef HAVE_GETTIMEOFDAY +int +gettimeofday (struct timeval *tv, struct timezone *tz) +{ + tv->tv_usec = 0; + tv->tv_sec = (long) time ((time_t) 0); +} +#endif + + double delta_time (struct timeval tv) { struct timeval now; - struct timezone tz; - double et; gettimeofday (&now, NULL); return ((double)(now.tv_sec - tv.tv_sec) + (double)(now.tv_usec - tv.tv_usec) / (double)1000000); @@ -366,8 +376,6 @@ strip (char *buffer) char * strscpy (char *dest, const char *src) { - size_t len; - if (src == NULL) return NULL; -- cgit v1.2.3-74-g34f1