dahdi: Use monotonic clock for coretimer.

DAHDI internal timing currently uses the "wall clock" to determine how much
time is passing for mixing and timers. When the wall time changes, like when
the system time is set via ntp or date, DAHDI currently will display a
"Detected time shift" message since it believes there is too much audio to
mix. There may also be audio problems if the wall time is shifting
occasionally due to slewing of the clock.

Now use a monotonic clock to determine how much real-time has passed for
timing purposes. This makes DAHDI insensitive to any changes in the wall time
on the system.

This only applies when using DAHDI's internal timer like when there are not
any telphony cards installed. There are still potential audio problems if the
platform is unable to accurately determine the passage of time.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10482 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Shaun Ruffell 2012-03-15 15:41:27 +00:00
parent 7ee8ba80cc
commit 2da38234d6

View File

@ -9595,7 +9595,7 @@ static void coretimer_func(unsigned long param)
const long MS_LIMIT = 3000; const long MS_LIMIT = 3000;
long difference; long difference;
now = current_kernel_time(); ktime_get_ts(&now);
if (atomic_read(&core_timer.count) == if (atomic_read(&core_timer.count) ==
atomic_read(&core_timer.last_count)) { atomic_read(&core_timer.last_count)) {
@ -9668,7 +9668,7 @@ static void coretimer_init(void)
{ {
init_timer(&core_timer.timer); init_timer(&core_timer.timer);
core_timer.timer.function = coretimer_func; core_timer.timer.function = coretimer_func;
core_timer.start_interval = current_kernel_time(); ktime_get_ts(&core_timer.start_interval);
atomic_set(&core_timer.count, 0); atomic_set(&core_timer.count, 0);
atomic_set(&core_timer.shutdown, 0); atomic_set(&core_timer.shutdown, 0);
core_timer.interval = max(msecs_to_jiffies(DAHDI_MSECS_PER_CHUNK), 1UL); core_timer.interval = max(msecs_to_jiffies(DAHDI_MSECS_PER_CHUNK), 1UL);