From: Paul Eggert Date: Thu, 30 Jun 2011 22:04:56 +0000 (-0700) Subject: * lib/timespec.h (timespec_sign): New inline function. X-Git-Tag: v0.1~2196 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=e115de06311db0fede74181edc5fa1e3baf5381b;p=gnulib.git * lib/timespec.h (timespec_sign): New inline function. --- diff --git a/ChangeLog b/ChangeLog index e68d6767a..31e04e8a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2011-06-30 Paul Eggert + * lib/timespec.h (timespec_sign): New inline function. + pselect: new module * lib/sys_select.in.h: Include , for 'sigset_t'. (pselect): New decls. diff --git a/lib/timespec.h b/lib/timespec.h index 74d5749df..d5b0996b8 100644 --- a/lib/timespec.h +++ b/lib/timespec.h @@ -57,6 +57,14 @@ timespec_cmp (struct timespec a, struct timespec b) : (int) (a.tv_nsec - b.tv_nsec)); } +/* Return -1, 0, 1, depending on the sign of A. A.tv_nsec must be + nonnegative. */ +static inline int +timespec_sign (struct timespec a) +{ + return a.tv_sec < 0 ? -1 : a.tv_sec || a.tv_nsec; +} + void gettime (struct timespec *); int settime (struct timespec const *);