more fixes related to GH #1453

This commit is contained in:
Guenter Obiltschnig
2016-12-06 21:47:39 +01:00
parent 376e703343
commit c8aa27381b
6 changed files with 53 additions and 17 deletions

View File

@@ -24,7 +24,7 @@
#if POCO_OS == POCO_OS_WINDOWS_NT
#include "Poco/UnWindows.h"
#elif POCO_OS == POCO_OS_MAC_OS_X
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_12 || __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 || __TV_OS_VERSION_MAX_ALLOWED >= __TVOS_10_0 || defined(__WATCH_OS_VERSION_MAX_ALLOWED)
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_12 || __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 || __TV_OS_VERSION_MAX_ALLOWED >= __TVOS_10_0 || __WATCH_OS_VERSION_MAX_ALLOWED >= __WATCHOS_3_0
#ifndef POCO_HAVE_STD_ATOMICS
#define POCO_HAVE_STD_ATOMICS
#endif

View File

@@ -34,6 +34,15 @@
#include <limits>
#ifndef POCO_HAVE_CLOCK_GETTIME
#if (defined(_POSIX_TIMERS) && defined(CLOCK_REALTIME)) || defined(POCO_VXWORKS) || defined(__QNX__)
#ifndef __APPLE__ // See GitHub issue #1453 - not available before Mac OS 10.12/iOS 10
#define POCO_HAVE_CLOCK_GETTIME
#endif
#endif
#endif
namespace Poco {
@@ -120,7 +129,7 @@ void Clock::update()
#endif
_clock = ClockVal(ts.tv_sec)*resolution() + ts.tv_nsec/1000;
#elif (defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK)) || defined(__QNX__)
#elif defined(POCO_HAVE_CLOCK_GETTIME)
struct timespec ts;
if (clock_gettime(CLOCK_MONOTONIC, &ts))

View File

@@ -37,6 +37,15 @@
#endif
#ifndef POCO_HAVE_CLOCK_GETTIME
#if (defined(_POSIX_TIMERS) && defined(CLOCK_REALTIME)) || defined(POCO_VXWORKS) || defined(__QNX__)
#ifndef __APPLE__ // See GitHub issue #1453 - not available before Mac OS 10.12/iOS 10
#define POCO_HAVE_CLOCK_GETTIME
#endif
#endif
#endif
namespace Poco {
@@ -127,7 +136,7 @@ bool EventImpl::waitImpl(long milliseconds)
abstime.tv_nsec -= 1000000000;
abstime.tv_sec++;
}
#elif (defined(_POSIX_TIMERS) && defined(CLOCK_REALTIME)) || defined(POCO_VXWORKS)
#elif defined(POCO_HAVE_CLOCK_GETTIME)
clock_gettime(CLOCK_REALTIME, &abstime);
abstime.tv_sec += milliseconds / 1000;
abstime.tv_nsec += (milliseconds % 1000)*1000000;

View File

@@ -35,6 +35,15 @@
#endif
#ifndef POCO_HAVE_CLOCK_GETTIME
#if (defined(_POSIX_TIMERS) && defined(CLOCK_REALTIME)) || defined(POCO_VXWORKS) || defined(__QNX__)
#ifndef __APPLE__ // See GitHub issue #1453 - not available before Mac OS 10.12/iOS 10
#define POCO_HAVE_CLOCK_GETTIME
#endif
#endif
#endif
namespace Poco {
@@ -98,7 +107,7 @@ bool MutexImpl::tryLockImpl(long milliseconds)
{
#if defined(POCO_HAVE_MUTEX_TIMEOUT)
struct timespec abstime;
#if defined(_POSIX_TIMERS) && defined(CLOCK_REALTIME)
#if defined(POCO_HAVE_CLOCK_GETTIME)
clock_gettime(CLOCK_REALTIME, &abstime);
abstime.tv_sec += milliseconds / 1000;
abstime.tv_nsec += (milliseconds % 1000)*1000000;

View File

@@ -37,6 +37,15 @@
#endif
#ifndef POCO_HAVE_CLOCK_GETTIME
#if (defined(_POSIX_TIMERS) && defined(CLOCK_REALTIME)) || defined(POCO_VXWORKS) || defined(__QNX__)
#ifndef __APPLE__ // See GitHub issue #1453 - not available before Mac OS 10.12/iOS 10
#define POCO_HAVE_CLOCK_GETTIME
#endif
#endif
#endif
namespace Poco {
@@ -127,7 +136,7 @@ bool SemaphoreImpl::waitImpl(long milliseconds)
abstime.tv_nsec -= 1000000000;
abstime.tv_sec++;
}
#elif (defined(_POSIX_TIMERS) && defined(CLOCK_REALTIME)) || defined(POCO_VXWORKS)
#elif defined(POCO_HAVE_CLOCK_GETTIME)
clock_gettime(CLOCK_REALTIME, &abstime);
abstime.tv_sec += milliseconds / 1000;
abstime.tv_nsec += (milliseconds % 1000)*1000000;