pps: unify timestamp gathering

Add a helper function to gather timestamps.  This way clients don't have
to duplicate it.

Signed-off-by: Alexander Gordeev <lasaine@lvk.cs.msu.su>
Acked-by: Rodolfo Giometti <giometti@linux.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Alexander Gordeev
2011-01-12 17:00:50 -08:00
committed by Linus Torvalds
parent 3003d55b59
commit 6f4229b511
6 changed files with 45 additions and 31 deletions

View File

@@ -40,18 +40,13 @@ static struct timer_list ktimer;
static void pps_ktimer_event(unsigned long ptr)
{
struct timespec __ts;
struct pps_ktime ts;
struct pps_event_time ts;
/* First of all we get the time stamp... */
getnstimeofday(&__ts);
pps_get_ts(&ts);
pr_info("PPS event at %lu\n", jiffies);
/* ... and translate it to PPS time data struct */
ts.sec = __ts.tv_sec;
ts.nsec = __ts.tv_nsec;
pps_event(source, &ts, PPS_CAPTUREASSERT, NULL);
mod_timer(&ktimer, jiffies + HZ);