initial commit
[glibc.git] / time / bits / types / struct_timespec.h
1 /* NB: Include guard matches what <linux/time.h> uses. */
2 #ifndef _STRUCT_TIMESPEC
3 #define _STRUCT_TIMESPEC 1
4
5 #include <bits/types.h>
6 #include <bits/endian.h>
7 #include <bits/types/time_t.h>
8
9 /* POSIX.1b structure for a time value. This is like a `struct timeval' but
10 has nanoseconds instead of microseconds. */
11 struct timespec
12 {
13 #ifdef __USE_TIME_BITS64
14 __time64_t tv_sec; /* Seconds. */
15 #else
16 __time_t tv_sec; /* Seconds. */
17 #endif
18 #if __WORDSIZE == 64 \
19 || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \
20 || (__TIMESIZE == 32 && !defined __USE_TIME_BITS64)
21 __syscall_slong_t tv_nsec; /* Nanoseconds. */
22 #else
23 # if __BYTE_ORDER == __BIG_ENDIAN
24 int: 32; /* Padding. */
25 long int tv_nsec; /* Nanoseconds. */
26 # else
27 long int tv_nsec; /* Nanoseconds. */
28 int: 32; /* Padding. */
29 # endif
30 #endif
31 };
32
33 #endif