kopia lustrzana https://github.com/Hamlib/Hamlib
Another attempt to get clock_gettime compiling for all Mac flavors
rodzic
30eca94210
commit
f2b7893a2b
23
src/misc.c
23
src/misc.c
|
@ -60,22 +60,23 @@
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
|
||||||
#include <AvailabilityMacros.h>
|
#include <time.h>
|
||||||
|
|
||||||
#if AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
|
#if !defined(CLOCK_REALTIME) && !defined(CLOCK_MONOTONIC)
|
||||||
|
//
|
||||||
|
// MacOS < 10.12 does not have clock_gettime
|
||||||
|
//
|
||||||
|
// Contribution from github user "ra1nb0w"
|
||||||
|
//
|
||||||
|
|
||||||
#else
|
#define CLOCK_REALTIME 0
|
||||||
|
#define CLOCK_MONOTONIC 6
|
||||||
# include <mach/mach_time.h>
|
|
||||||
# ifndef __clockid_t_defined
|
|
||||||
typedef int clockid_t;
|
typedef int clockid_t;
|
||||||
#define __clockid_t_defined 1
|
|
||||||
# endif /* __clockid_t_defined */
|
|
||||||
|
|
||||||
# define CLOCK_REALTIME 0
|
#include <sys/time.h>
|
||||||
# define CLOCK_MONOTONIC 1
|
#include <mach/mach_time.h>
|
||||||
|
|
||||||
int clock_gettime(clockid_t clock_id, struct timespec *tp)
|
static int clock_gettime(clockid_t clock_id, struct timespec *tp)
|
||||||
{
|
{
|
||||||
if (clock_id == CLOCK_REALTIME)
|
if (clock_id == CLOCK_REALTIME)
|
||||||
{
|
{
|
||||||
|
|
Ładowanie…
Reference in New Issue