Conflicts between time.h and linux / time.h prevent me from using CLOCK_TAI

I would like to use

#include <time.h>
clock_gettime(CLOCK_TAI, &...);

but unfortunately CLOCK_TAIit is not listed in the time.h header (at least in openSUSE 13.2). However, it is defined in linux / time.h and is actually supported by the operating system. But if I include the last header, it causes a bunch of ad conflicts - compared to time.h and bits / types.h. Enabling only linux / time.h does not help, since time.h and / or bits / types.h will be implicitly included in common headers, such as unistd.h or stdlib.h.


So, I tried to resolve the conflicts manually. In particular, the first compiler error message was about timespecredeclaration, so I wrote in my code:

#include <time.h>
#if defined(__timespec_defined) && !defined(_STRUCT_TIMESPEC)
    #define _STRUCT_TIMESPEC
#endif
#include <linux/time.h>

, itimerspec redeclaration, . time.h :

#include <linux/time.h>
#ifndef _TIME_H
    #define _TIME_H
#endif

, timeval redeclaration. /types.h:

#include <linux/time.h>
#ifndef _TIME_H
    #define _TIME_H
#endif
#ifndef _BITS_TYPES_H
    #define _BITS_TYPES_H
#endif

, , , size_t. linux/types.h :

#ifndef _LINUX_TYPES_H
    #define _LINUX_TYPES_H
#endif
#include <linux/time.h>
#ifndef _TIME_H
    #define _TIME_H
#endif

, , __kernel_time_t, timespec ..


, : linux/... stdlib.h ? CLOCK_TAI?

0

All Articles