timekeeping: Add CLOCK_TAI clockid

This add a CLOCK_TAI clockid and the needed accessors.

CC: Thomas Gleixner <tglx@linutronix.de>
CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
This commit is contained in:
John Stultz
2012-05-03 12:43:40 -07:00
parent cc244ddae6
commit 1ff3c9677b
4 changed files with 43 additions and 4 deletions
+30
View File
@@ -379,6 +379,36 @@ void ktime_get_ts(struct timespec *ts)
}
EXPORT_SYMBOL_GPL(ktime_get_ts);
/**
* timekeeping_clocktai - Returns the TAI time of day in a timespec
* @ts: pointer to the timespec to be set
*
* Returns the time of day in a timespec.
*/
void timekeeping_clocktai(struct timespec *ts)
{
struct timekeeper *tk = &timekeeper;
unsigned long seq;
u64 nsecs;
WARN_ON(timekeeping_suspended);
do {
seq = read_seqbegin(&tk->lock);
ts->tv_sec = tk->xtime_sec + tk->tai_offset;
nsecs = timekeeping_get_ns(tk);
} while (read_seqretry(&tk->lock, seq));
ts->tv_nsec = 0;
timespec_add_ns(ts, nsecs);
}
EXPORT_SYMBOL(timekeeping_clocktai);
#ifdef CONFIG_NTP_PPS
/**