From: Paul Eggert Date: Thu, 30 Jun 2011 22:06:54 +0000 (-0700) Subject: * lib/timespec.h (timespectod): New inline function. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a37ff9e61f483132e7734f929e6675b1651a647;p=pspp * lib/timespec.h (timespectod): New inline function. --- diff --git a/ChangeLog b/ChangeLog index 31e04e8a0a..0f37252610 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 d5b0996b8c..071f3a1fbc 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 *);