Try to clean up the compat stuff a bit
This commit is contained in:
parent
74e11bd26f
commit
286a6301f8
|
|
@ -58,8 +58,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "clock_gettime.h"
|
||||
#include "../compat.h"
|
||||
#include <mach/mach_time.h>
|
||||
#include <mach/clock.h> // for clock_get_time
|
||||
#include <mach/clock_types.h> // for mach_timespec_t, CALENDAR_CLOCK, etc
|
||||
#include <mach/kern_return.h> // for KERN_SUCCESS, kern_return_t
|
||||
|
|
@ -70,6 +70,8 @@
|
|||
#include <errno.h> // for EINVAL, errno
|
||||
#include <unistd.h> // for getpid
|
||||
|
||||
static mach_timebase_info_data_t __clock_gettime_inf;
|
||||
|
||||
int clock_gettime(clockid_t clk_id, struct timespec *tp)
|
||||
{
|
||||
kern_return_t ret;
|
||||
|
|
|
|||
|
|
@ -1,35 +1,6 @@
|
|||
#ifndef CLOCK_GETTIME_H
|
||||
#define CLOCK_GETTIME_H
|
||||
|
||||
#include <mach/mach_time.h> // Apple-only, but this isn't inclued on other BSDs
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
#ifdef _CLOCKID_T_DEFINED_
|
||||
#define CLOCKID_T
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#ifdef CLOCK_MONOTONIC
|
||||
#define CLOCKID_T
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CLOCKID_T
|
||||
#define CLOCKID_T
|
||||
typedef enum
|
||||
{
|
||||
CLOCK_REALTIME,
|
||||
CLOCK_MONOTONIC,
|
||||
CLOCK_PROCESS_CPUTIME_ID,
|
||||
CLOCK_THREAD_CPUTIME_ID
|
||||
} clockid_t;
|
||||
#endif // ifndef CLOCKID_T
|
||||
|
||||
struct timespec;
|
||||
|
||||
static mach_timebase_info_data_t __clock_gettime_inf;
|
||||
|
||||
int clock_gettime(clockid_t clk_id, struct timespec *tp);
|
||||
|
||||
#endif // CLOCK_GETTIME_H
|
||||
|
|
|
|||
|
|
@ -22,10 +22,7 @@
|
|||
#include <errno.h> // for errno, EINVAL
|
||||
#include <time.h> // for nanosleep, NULL
|
||||
|
||||
#include "clock_nanosleep.h"
|
||||
#ifdef MISSING_GETTIME
|
||||
#include "../clock_gettime/clock_gettime.h" // for clock_gettime
|
||||
#endif
|
||||
#include "../compat.h"
|
||||
|
||||
int clock_nanosleep(clockid_t id, int flags, const struct timespec *ts,
|
||||
struct timespec *ots) {
|
||||
|
|
|
|||
|
|
@ -1,36 +1,6 @@
|
|||
#ifndef CLOCK_NANOSLEEP_H
|
||||
#define CLOCK_NANOSLEEP_H
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
#ifdef _CLOCKID_T_DEFINED_
|
||||
#define CLOCKID_T
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#ifdef CLOCK_MONOTONIC
|
||||
#define CLOCKID_T
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CLOCKID_T
|
||||
#define CLOCKID_T
|
||||
typedef enum
|
||||
{
|
||||
CLOCK_REALTIME,
|
||||
CLOCK_MONOTONIC,
|
||||
CLOCK_PROCESS_CPUTIME_ID,
|
||||
CLOCK_THREAD_CPUTIME_ID
|
||||
} clockid_t;
|
||||
#endif // ifndef CLOCKID_T
|
||||
|
||||
|
||||
#ifndef TIMER_ABSTIME
|
||||
#define TIMER_ABSTIME 1
|
||||
#endif // TIMER_ABSTIME
|
||||
|
||||
struct timespec;
|
||||
|
||||
int clock_nanosleep (clockid_t id, int flags, const struct timespec *ts,
|
||||
struct timespec *ots);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,30 @@
|
|||
|
||||
#endif
|
||||
|
||||
/* clock_* and time-related types */
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#if defined(CLOCK_REALTIME)
|
||||
# define HAVE_CLOCKID_T
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_CLOCKID_T
|
||||
typedef enum
|
||||
{
|
||||
CLOCK_REALTIME,
|
||||
CLOCK_MONOTONIC,
|
||||
CLOCK_PROCESS_CPUTIME_ID,
|
||||
CLOCK_THREAD_CPUTIME_ID
|
||||
} clockid_t;
|
||||
#endif // !HAVE_CLOCKID_T
|
||||
|
||||
#ifndef TIMER_ABSTIME
|
||||
#define TIMER_ABSTIME 1
|
||||
#endif // !TIMER_ABSTIME
|
||||
|
||||
struct timespec;
|
||||
|
||||
#ifdef MISSING_NANOSLEEP
|
||||
#include "clock_nanosleep/clock_nanosleep.h"
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue