X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Ftimespec.h;h=d0c029b57049d47792708fd4c5919919e15832a1;hb=beae0bdcf7fe30f2415c16f6b8c1368d469e519c;hp=d665e6ccf9ae99539ca2ccf1a41144b91ed4d4a7;hpb=9fc81090f6c5590bd1b0e0fa5087577a2ee43a3e;p=gnulib.git diff --git a/lib/timespec.h b/lib/timespec.h index d665e6ccf..d0c029b57 100644 --- a/lib/timespec.h +++ b/lib/timespec.h @@ -21,11 +21,31 @@ # include +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif _GL_INLINE_HEADER_BEGIN #ifndef _GL_TIMESPEC_INLINE # define _GL_TIMESPEC_INLINE _GL_INLINE #endif +/* Resolution of timespec time stamps (in units per second), and log + base 10 of the resolution. */ + +enum { TIMESPEC_RESOLUTION = 1000000000 }; +enum { LOG10_TIMESPEC_RESOLUTION = 9 }; + +/* Return a timespec with seconds S and nanoseconds NS. */ + +_GL_TIMESPEC_INLINE struct timespec +make_timespec (time_t s, long int ns) +{ + struct timespec r; + r.tv_sec = s; + r.tv_nsec = ns; + return r; +} + /* Return negative, zero, positive if A < B, A == B, A > B, respectively. For each time stamp T, this code assumes that either: