summaryrefslogtreecommitdiffstats
path: root/plugins/utils.c
diff options
context:
space:
mode:
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>2002-11-08 07:20:05 (GMT)
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>2002-11-08 07:20:05 (GMT)
commit1c4dd10d70ba9ed6dead6cc56cd0f572627cf619 (patch)
tree62485f23a5478eb8a6ad6b2de1eac322bf195662 /plugins/utils.c
parent34ba941736b434a6c1453feec35d04ed7b0a59e5 (diff)
downloadmonitoring-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.c16
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
45int is_option (char *str); 45int is_option (char *str);
46 46
47double delta_time (struct timeval tv);
48
47void strip (char *); 49void strip (char *);
48char *strscpy (char *dest, const char *src); 50char *strscpy (char *dest, const char *src);
49char *strscat (char *dest, const char *src); 51char *strscat (char *dest, const char *src);
@@ -315,13 +317,21 @@ is_option (char *str)
315 317
316 318
317 319
320#ifndef HAVE_GETTIMEOFDAY
321int
322gettimeofday (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
319double 331double
320delta_time (struct timeval tv) 332delta_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)
366char * 376char *
367strscpy (char *dest, const char *src) 377strscpy (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