Re: [PATCH net-next 5/5] ptp: start virtual clocks at current system time.
From: Richard Cochran <richardcochran@gmail.com>
Date: 2022-02-01 19:04:02
On Mon, Jan 31, 2022 at 11:21:08AM +0100, Miroslav Lichvar wrote:
On Thu, Jan 27, 2022 at 02:01:16PM -0800, Richard Cochran wrote:quoted
On Thu, Jan 27, 2022 at 12:45:36PM +0100, Miroslav Lichvar wrote:quoted
When a virtual clock is being created, initialize the timecounter to the current system time instead of the Unix epoch to avoid very large steps when the clock will be synchronized.I think we agreed that, going forward, new PHC drivers should start at zero (1970) instead of TAI - 37.I tried to find the discussion around this decision, but failed. Do you have a link?
Here is one of the discussions. It didn't lay down a law or anything, but my arguments still stand. https://lore.kernel.org/all/20180815175040.3736548-1-arnd@arndb.de/ (local) I've been pushing back on new drivers that use ktime_get isntead of zero, but some still sneak through, now and again.
To me, it seems very strange to start the PHC at 0. It makes the initial clock correction unnecessarily larger by ~7 orders of magnitude. The system clock is initialized from the RTC, which can have an error comparable to the TAI-UTC offset, especially if the machine was turned off for a longer period of time, so why not initialize the PHC from the system time? The error is much smaller than billions of seconds.
Who cares? The size of the error is irrelevant, because the initial offset is wrong, and the action of the PTP will correct it, whether large or small. Thanks, Richard