From 2da38234d62a65b0dbc81b1bb2b6f91d286ceeaa Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Thu, 15 Mar 2012 15:41:27 +0000 Subject: [PATCH] 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 Acked-by: Tzafrir Cohen Acked-by: Russ Meyerriecks git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10482 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/dahdi-base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 6db1f3f..88e44be 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -9595,7 +9595,7 @@ static void coretimer_func(unsigned long param) const long MS_LIMIT = 3000; long difference; - now = current_kernel_time(); + ktime_get_ts(&now); if (atomic_read(&core_timer.count) == atomic_read(&core_timer.last_count)) { @@ -9668,7 +9668,7 @@ static void coretimer_init(void) { init_timer(&core_timer.timer); 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.shutdown, 0); core_timer.interval = max(msecs_to_jiffies(DAHDI_MSECS_PER_CHUNK), 1UL);