try to use clock_gettime to make sure we don't care if the system time changes

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7165 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2008-01-11 00:43:49 +00:00
parent 886f99735a
commit 143bed09a3
38 changed files with 174 additions and 104 deletions

View File

@@ -77,7 +77,7 @@ static int task_thread_loop(int done)
if (done) {
tp->destroyed = 1;
} else {
int64_t now = time(NULL);
int64_t now = switch_timestamp(NULL);
if (now >= tp->task.runtime && !tp->in_thread) {
int32_t diff = (int32_t)(now - tp->task.runtime);
if (diff > 1) {
@@ -160,7 +160,7 @@ SWITCH_DECLARE(uint32_t) switch_scheduler_add_task(time_t task_runtime,
switch_zmalloc(container, sizeof(*container));
switch_assert(func);
container->func = func;
container->task.created = time(NULL);
container->task.created = switch_timestamp(NULL);
container->task.runtime = task_runtime;
container->task.group = strdup(group ? group : "none");
container->task.cmd_id = cmd_id;