diff options
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 a4519f25..bf1d2047 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 | ||