mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 23:21:46 +00:00
pps: capture MONOTONIC_RAW timestamps as well
MONOTONIC_RAW clock timestamps are ideally suited for frequency calculation and also fit well into the original NTP hardpps design. Now phase and frequency can be adjusted separately: the former based on REALTIME clock and the latter based on MONOTONIC_RAW clock. A new function getnstime_raw_and_real is added to timekeeping subsystem to capture both timestamps at the same time and atomically. Signed-off-by: Alexander Gordeev <lasaine@lvk.cs.msu.su> Acked-by: John Stultz <johnstul@us.ibm.com> Cc: Rodolfo Giometti <giometti@enneenne.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
025b40abe7
commit
e2c18e49a0
3 changed files with 59 additions and 0 deletions
|
@ -47,6 +47,9 @@ struct pps_source_info {
|
|||
};
|
||||
|
||||
struct pps_event_time {
|
||||
#ifdef CONFIG_NTP_PPS
|
||||
struct timespec ts_raw;
|
||||
#endif /* CONFIG_NTP_PPS */
|
||||
struct timespec ts_real;
|
||||
};
|
||||
|
||||
|
@ -97,10 +100,21 @@ static inline void timespec_to_pps_ktime(struct pps_ktime *kt,
|
|||
kt->nsec = ts.tv_nsec;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NTP_PPS
|
||||
|
||||
static inline void pps_get_ts(struct pps_event_time *ts)
|
||||
{
|
||||
getnstime_raw_and_real(&ts->ts_raw, &ts->ts_real);
|
||||
}
|
||||
|
||||
#else /* CONFIG_NTP_PPS */
|
||||
|
||||
static inline void pps_get_ts(struct pps_event_time *ts)
|
||||
{
|
||||
getnstimeofday(&ts->ts_real);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NTP_PPS */
|
||||
|
||||
#endif /* LINUX_PPS_KERNEL_H */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue