http://bugzilla.opensuse.org/show_bug.cgi?id=936251 Bug ID: 936251 Summary: bits/time.h misses CLOCK_TAI that is present in linux/time.h Classification: openSUSE Product: openSUSE Distribution Version: 13.2 Hardware: i686 OS: openSUSE 13.2 Status: NEW Severity: Normal Priority: P5 - None Component: Development Assignee: bnc-team-screening@forge.provo.novell.com Reporter: avsco@mail.ru QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- Currently, /usr/include/bits/time.h defines these clock types for `clock_gettime()` function (from /usr/include/time.h):
# define CLOCK_REALTIME 0 # define CLOCK_MONOTONIC 1 # define CLOCK_PROCESS_CPUTIME_ID 2 # define CLOCK_THREAD_CPUTIME_ID 3 # define CLOCK_MONOTONIC_RAW 4 # define CLOCK_REALTIME_COARSE 5 # define CLOCK_MONOTONIC_COARSE 6 # define CLOCK_BOOTTIME 7 # define CLOCK_REALTIME_ALARM 8 # define CLOCK_BOOTTIME_ALARM 9
However, in /usr/include/linux/time.h we have more options:
#define CLOCK_REALTIME 0 #define CLOCK_MONOTONIC 1 #define CLOCK_PROCESS_CPUTIME_ID 2 #define CLOCK_THREAD_CPUTIME_ID 3 #define CLOCK_MONOTONIC_RAW 4 #define CLOCK_REALTIME_COARSE 5 #define CLOCK_MONOTONIC_COARSE 6 #define CLOCK_BOOTTIME 7 #define CLOCK_REALTIME_ALARM 8 #define CLOCK_BOOTTIME_ALARM 9 #define CLOCK_SGI_CYCLE 10 #define CLOCK_TAI 11
When called with hardcoded value 11 for CLOCK_TAI, clock_gettime() succeeds and indeed returns a value that differs from REALTIME by a configured TAI offset, so I confidently conclude that openSUSE's kernel really supports CLOCK_TAI. Thus /usr/include/bits/time.h should be updated to reflect such capability. As a workaround, I tried to include <linux/time.h> instead of or in addition to <time.h>, but they (and other header files included by them) turned out to be highly incompatible due to competing declarations, some of which cannot be prevented by include guards. (The progress of my vain workarounds is covered in more detail at http://stackoverflow.com/q/31056979) Anyway, I suppose that including anything from <linux/...> should be generally avoided in userland programs, unless they are doing something very system-specific, for which `clock_gettime()` does not qualify at all. -- You are receiving this mail because: You are on the CC list for the bug.