diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/timespec.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/timespec.h b/lib/timespec.h index d665e6ccf9a..c7450ad8de0 100644 --- a/lib/timespec.h +++ b/lib/timespec.h | |||
| @@ -26,6 +26,23 @@ _GL_INLINE_HEADER_BEGIN | |||
| 26 | # define _GL_TIMESPEC_INLINE _GL_INLINE | 26 | # define _GL_TIMESPEC_INLINE _GL_INLINE |
| 27 | #endif | 27 | #endif |
| 28 | 28 | ||
| 29 | /* Resolution of timespec time stamps (in units per second), and log | ||
| 30 | base 10 of the resolution. */ | ||
| 31 | |||
| 32 | enum { TIMESPEC_RESOLUTION = 1000000000 }; | ||
| 33 | enum { LOG10_TIMESPEC_RESOLUTION = 9 }; | ||
| 34 | |||
| 35 | /* Return a timespec with seconds S and nanoseconds NS. */ | ||
| 36 | |||
| 37 | _GL_TIMESPEC_INLINE struct timespec | ||
| 38 | make_timespec (time_t s, long int ns) | ||
| 39 | { | ||
| 40 | struct timespec r; | ||
| 41 | r.tv_sec = s; | ||
| 42 | r.tv_nsec = ns; | ||
| 43 | return r; | ||
| 44 | } | ||
| 45 | |||
| 29 | /* Return negative, zero, positive if A < B, A == B, A > B, respectively. | 46 | /* Return negative, zero, positive if A < B, A == B, A > B, respectively. |
| 30 | 47 | ||
| 31 | For each time stamp T, this code assumes that either: | 48 | For each time stamp T, this code assumes that either: |