Commit 4c86dfce authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(timeval_diff_d): New function.

parent d8b48642
......@@ -144,6 +144,12 @@ timeval_diff_sec(struct timeval a, struct timeval b)
return res.tv_sec + (res.tv_usec >= 500000);
}
double
timeval_diff_d(struct timeval a, struct timeval b)
{
return (a.tv_sec - b.tv_sec) + 1e-6 * (a.tv_usec - b.tv_usec);
}
int
setup_timer(struct timeval *tv,
struct timeval interval)
......
......@@ -42,6 +42,9 @@ extern Bool timeval_less(struct timeval a, struct timeval b);
/* Return the difference as a number of seconds, properly rounded. */
extern long timeval_diff_sec(struct timeval a, struct timeval b);
/* Return the difference as a number of seconds, as a double. */
extern double timeval_diff_d(struct timeval a, struct timeval b);
/* Set TV to the current time plus INTERVAL. Return -1 if
gettimeofday() fails (check errno). */
extern int setup_timer(struct timeval *tv, struct timeval interval);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment