Re: [PATCH 2/5] pps: capture MONOTONIC_RAW timestamps as well

From: Alexander Gordeev
Date: Thu Feb 04 2010 - 06:05:39 EST


Ð Wed, 03 Feb 2010 14:26:16 -0800
john stultz <johnstul@xxxxxxxxxx> ÐÐÑÐÑ:

> On Wed, 2010-02-03 at 23:56 +0300, Alexander Gordeev wrote:
> > 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.
>
> Hrmm. So while I understand the need for it, the
> getnstime_raw_and_real() makes me cringe a little. Part of the issue
> is that there are multiple CLOCK_IDs and the current interface allows
> for accesses to only one at a time. There's a similar hack in the
> hrtimer code to get the CLOCK_REALTIME and CLOCK_MONOTONIC values at
> the same time. Next I worry that folks will want a
> getnstime_mono_and_raw() or a getnstime_real_mono_and_raw(), then a
> getnstime_real_and_realcoarse(), etc..
>
> I'm almost thinking the way to handle this would be a better
> abstraction, like a get_two_times(CLOCKID, timepsec*, CLOCKID,
> timespec*). But that might need some further discussion. Anyone else
> have thoughts here?

Agreed with you completely. I don't like the approach but failed to
invent anything better.

> So yea not opposed to this patch, but maybe try to avoid exporting the
> symbol, so modules don't end up using it and we can change it fairly
> easily later.

Well, I'd like to, but how? getnstime_raw_and_real() is used in
module added in one of the next commits.

--
Alexander

Attachment: signature.asc
Description: PGP signature