some time changes
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6238 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
ed9dc194e7
commit
eb9f9fb263
|
@ -56,7 +56,7 @@ src/switch_stun.c\
|
||||||
src/switch_log.c\
|
src/switch_log.c\
|
||||||
src/switch_xml.c\
|
src/switch_xml.c\
|
||||||
src/switch_config.c\
|
src/switch_config.c\
|
||||||
src/softtimer.c\
|
src/switch_time.c\
|
||||||
libs/stfu/stfu.c\
|
libs/stfu/stfu.c\
|
||||||
src/switch_cpp.cpp\
|
src/switch_cpp.cpp\
|
||||||
libs/libteletone/src/libteletone_detect.c\
|
libs/libteletone/src/libteletone_detect.c\
|
||||||
|
|
|
@ -188,6 +188,9 @@ AC_FUNC_STRFTIME
|
||||||
AC_CHECK_FUNCS([gethostname vasprintf mmap mlock mlockall usleep])
|
AC_CHECK_FUNCS([gethostname vasprintf mmap mlock mlockall usleep])
|
||||||
AC_CHECK_FUNCS([sched_setscheduler setpriority setrlimit setgroups initgroups])
|
AC_CHECK_FUNCS([sched_setscheduler setpriority setrlimit setgroups initgroups])
|
||||||
|
|
||||||
|
AC_CHECK_LIB(rt, clock_gettime, [AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])])
|
||||||
|
AC_CHECK_LIB(rt, clock_nanosleep, [AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define if you have clock_nanosleep()])])
|
||||||
|
|
||||||
AC_CHECK_DECL([RLIMIT_MEMLOCK],
|
AC_CHECK_DECL([RLIMIT_MEMLOCK],
|
||||||
[AC_DEFINE([HAVE_RLIMIT_MEMLOCK],[1],[RLIMIT_MEMLOCK constant for setrlimit])],,
|
[AC_DEFINE([HAVE_RLIMIT_MEMLOCK],[1],[RLIMIT_MEMLOCK constant for setrlimit])],,
|
||||||
[#ifdef HAVE_SYS_RESOURCE_H
|
[#ifdef HAVE_SYS_RESOURCE_H
|
||||||
|
|
|
@ -233,7 +233,13 @@ SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t * lock)
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_time_t) switch_time_now(void)
|
SWITCH_DECLARE(switch_time_t) switch_time_now(void)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_CLOCK_GETTIME
|
||||||
|
struct timespec ts;
|
||||||
|
clock_gettime(CLOCK_REALTIME,&ts);
|
||||||
|
return ts.tv_sec * APR_USEC_PER_SEC + (ts.tv_nsec/1000);
|
||||||
|
#else
|
||||||
return (switch_time_t) apr_time_now();
|
return (switch_time_t) apr_time_now();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t * result, switch_time_exp_t * input)
|
SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t * result, switch_time_exp_t * input)
|
||||||
|
@ -256,17 +262,6 @@ SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t * result,
|
||||||
return apr_time_exp_gmt((apr_time_exp_t *) result, input);
|
return apr_time_exp_gmt((apr_time_exp_t *) result, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t)
|
|
||||||
{
|
|
||||||
#if defined(HAVE_USLEEP)
|
|
||||||
usleep(t);
|
|
||||||
#elif defined(WIN32)
|
|
||||||
Sleep((DWORD) ((t) / 1000));
|
|
||||||
#else
|
|
||||||
apr_sleep(t);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_rfc822_date(char *date_str, switch_time_t t)
|
SWITCH_DECLARE(switch_status_t) switch_rfc822_date(char *date_str, switch_time_t t)
|
||||||
{
|
{
|
||||||
|
|
|
@ -80,6 +80,29 @@ static timer_matrix_t TIMER_MATRIX[MAX_ELEMENTS + 1];
|
||||||
#define IDLE_SPEED 100
|
#define IDLE_SPEED 100
|
||||||
|
|
||||||
|
|
||||||
|
SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t)
|
||||||
|
{
|
||||||
|
|
||||||
|
#if defined(HAVE_CLOCK_NANOSLEEP)
|
||||||
|
struct timespec ts;
|
||||||
|
ts.tv_sec = t / APR_USEC_PER_SEC;
|
||||||
|
ts.tv_nsec = (t % APR_USEC_PER_SEC) * 1000;
|
||||||
|
|
||||||
|
clock_nanosleep(CLOCK_REALTIME, 0, &ts, NULL);
|
||||||
|
|
||||||
|
#elif defined(HAVE_USLEEP)
|
||||||
|
usleep(t);
|
||||||
|
#elif defined(WIN32)
|
||||||
|
Sleep((DWORD) ((t) / 1000));
|
||||||
|
#else
|
||||||
|
apr_sleep(t);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static switch_status_t timer_init(switch_timer_t *timer)
|
static switch_status_t timer_init(switch_timer_t *timer)
|
||||||
{
|
{
|
||||||
timer_private_t *private_info;
|
timer_private_t *private_info;
|
Loading…
Reference in New Issue