From 1a37ff9e61f483132e7734f929e6675b1651a647 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 30 Jun 2011 15:06:54 -0700 Subject: [PATCH] * lib/timespec.h (timespectod): New inline function. --- ChangeLog | 2 +- lib/timespec.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 31e04e8a0..0f3725261 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,6 @@ 2011-06-30 Paul Eggert - * lib/timespec.h (timespec_sign): New inline function. + * lib/timespec.h (timespec_sign, timespectod): New inline functions. pselect: new module * lib/sys_select.in.h: Include , for 'sigset_t'. diff --git a/lib/timespec.h b/lib/timespec.h index d5b0996b8..071f3a1fb 100644 --- a/lib/timespec.h +++ b/lib/timespec.h @@ -65,6 +65,13 @@ timespec_sign (struct timespec a) return a.tv_sec < 0 ? -1 : a.tv_sec || a.tv_nsec; } +/* Return an approximation to A, of type 'double'. */ +static inline double +timespectod (struct timespec a) +{ + return a.tv_sec + a.tv_nsec / 1e9; +} + void gettime (struct timespec *); int settime (struct timespec const *); -- 2.11.0