[PATCH] rtc: Allow rtc drivers to specify the tv_nsec value for ntp

Alexandre Belloni alexandre.belloni at free-electrons.com
Mon Nov 27 10:48:18 PST 2017


On 23/11/2017 at 16:10:40 +0000, Russell King - ARM Linux wrote:
> On Thu, Nov 23, 2017 at 04:36:37PM +0100, Alexandre Belloni wrote:
> > On 23/11/2017 at 08:04:39 -0700, Jason Gunthorpe wrote:
> > > On Thu, Nov 23, 2017 at 10:54:56AM +0100, Alexandre Belloni wrote:
> > > You can't really measure the offset without doing a time set, many
> > > embedded RTCs do not hook up interrupts, etc.
> > 
> > If you don't hook up the interrupt, then all you did is completely
> > pointless because you will never be able to read the correct time from
> > the RTC, you'll have up to a 1s offset.
> 
> That is incorrect.  The kernel provides emulation for the update
> interrupt - it polls the RTC every 1/HZ checking it for a change
> in seconds.
> 
> So, you end up with up to a 1/HZ offset where no interrupt is
> present.
> 

Yes, I forgot about the UIE emulation.

> Please don't base your assumptions on the output of hwclock(8) -
> the output of that which comes after the timezone specifier is
> not documented in the man page, and appears on the face of it to
> be rather random:
> 

I'm not basing myself on hwclock's output because it is indeed quite
random.


-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com



More information about the linux-arm-kernel mailing list