diff options
| -rw-r--r-- | include/linux/timekeeping.h | 5 | ||||
| -rw-r--r-- | kernel/time/timekeeping.c | 31 |
2 files changed, 5 insertions, 31 deletions
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 7b8f20007871..f0f12a84a31b 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h | |||
| @@ -166,6 +166,11 @@ static inline void get_monotonic_boottime(struct timespec *ts) | |||
| 166 | *ts = ktime_to_timespec(ktime_get_boottime()); | 166 | *ts = ktime_to_timespec(ktime_get_boottime()); |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | static inline void timekeeping_clocktai(struct timespec *ts) | ||
| 170 | { | ||
| 171 | *ts = ktime_to_timespec(ktime_get_clocktai()); | ||
| 172 | } | ||
| 173 | |||
| 169 | /* | 174 | /* |
| 170 | * RTC specific | 175 | * RTC specific |
| 171 | */ | 176 | */ |
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 50d5de05b837..118e91e3071c 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
| @@ -497,37 +497,6 @@ void ktime_get_ts64(struct timespec64 *ts) | |||
| 497 | } | 497 | } |
| 498 | EXPORT_SYMBOL_GPL(ktime_get_ts64); | 498 | EXPORT_SYMBOL_GPL(ktime_get_ts64); |
| 499 | 499 | ||
| 500 | |||
| 501 | /** | ||
| 502 | * timekeeping_clocktai - Returns the TAI time of day in a timespec | ||
| 503 | * @ts: pointer to the timespec to be set | ||
| 504 | * | ||
| 505 | * Returns the time of day in a timespec. | ||
| 506 | */ | ||
| 507 | void timekeeping_clocktai(struct timespec *ts) | ||
| 508 | { | ||
| 509 | struct timekeeper *tk = &tk_core.timekeeper; | ||
| 510 | struct timespec64 ts64; | ||
| 511 | unsigned long seq; | ||
| 512 | u64 nsecs; | ||
| 513 | |||
| 514 | WARN_ON(timekeeping_suspended); | ||
| 515 | |||
| 516 | do { | ||
| 517 | seq = read_seqcount_begin(&tk_core.seq); | ||
| 518 | |||
| 519 | ts64.tv_sec = tk->xtime_sec + tk->tai_offset; | ||
| 520 | nsecs = timekeeping_get_ns(tk); | ||
| 521 | |||
| 522 | } while (read_seqcount_retry(&tk_core.seq, seq)); | ||
| 523 | |||
| 524 | ts64.tv_nsec = 0; | ||
| 525 | timespec64_add_ns(&ts64, nsecs); | ||
| 526 | *ts = timespec64_to_timespec(ts64); | ||
| 527 | |||
| 528 | } | ||
| 529 | EXPORT_SYMBOL(timekeeping_clocktai); | ||
| 530 | |||
| 531 | #ifdef CONFIG_NTP_PPS | 500 | #ifdef CONFIG_NTP_PPS |
| 532 | 501 | ||
| 533 | /** | 502 | /** |
