aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/timespec.h17
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
32enum { TIMESPEC_RESOLUTION = 1000000000 };
33enum { LOG10_TIMESPEC_RESOLUTION = 9 };
34
35/* Return a timespec with seconds S and nanoseconds NS. */
36
37_GL_TIMESPEC_INLINE struct timespec
38make_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: