deal with linux platforms that have clock_gettime but don't define CLOCK_MONOTONIC. (FSCORE-111)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7950 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
e34e139f8b
commit
1e21db8022
|
@ -95,7 +95,7 @@ SWITCH_DECLARE(time_t) switch_timestamp(time_t *t)
|
||||||
return now;
|
return now;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_CLOCK_GETTIME)
|
#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
|
||||||
static int MONO = 1;
|
static int MONO = 1;
|
||||||
#else
|
#else
|
||||||
static int MONO = 0;
|
static int MONO = 0;
|
||||||
|
@ -105,7 +105,7 @@ static switch_time_t time_now(int64_t offset)
|
||||||
{
|
{
|
||||||
switch_time_t now;
|
switch_time_t now;
|
||||||
|
|
||||||
#if defined(HAVE_CLOCK_GETTIME)
|
#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
|
||||||
if (MONO) {
|
if (MONO) {
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
|
@ -114,7 +114,7 @@ static switch_time_t time_now(int64_t offset)
|
||||||
#endif
|
#endif
|
||||||
now = switch_time_now();
|
now = switch_time_now();
|
||||||
|
|
||||||
#if defined(HAVE_CLOCK_GETTIME)
|
#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue