summaryrefslogtreecommitdiffstats
path: root/plugins/utils.c
diff options
context:
space:
mode:
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