Re: [Ntp] CLOCK_TAI (was NTPv5: big picture)

Miroslav Lichvar <mlichvar@redhat.com> Tue, 05 January 2021 14:42 UTC

Return-Path: <mlichvar@redhat.com>
X-Original-To: ntp@ietfa.amsl.com
Delivered-To: ntp@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id A11733A0F48 for <ntp@ietfa.amsl.com>; Tue, 5 Jan 2021 06:42:34 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.37
X-Spam-Level:
X-Spam-Status: No, score=-2.37 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id m3OJnRE0nsFl for <ntp@ietfa.amsl.com>; Tue, 5 Jan 2021 06:42:33 -0800 (PST)
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id F115B3A0F41 for <ntp@ietf.org>; Tue, 5 Jan 2021 06:42:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609857752; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LhJwmlsfKqK1acYPoc5uRDCPheOWXGCDdWHSNCFVuXE=; b=EF5tgeLkBXckw7YTdkN/ev3bsrT0MduLmQe1sZa5La1pKo/EE0JYO27qAvljU8wlSvY0rY HKf+IuDCg0zjoXJ2Ymrj1vurp3hiA5Oq4t06+A0Z5b1sinib3echlnxkVxqABX4cq/NsPV zxU6aNAII+j4tp/uvkeWwwkLN0jdOqY=
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-572-NyX9F7ScNiKApwAl9Ttorg-1; Tue, 05 Jan 2021 09:42:30 -0500
X-MC-Unique: NyX9F7ScNiKApwAl9Ttorg-1
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 26FEEA0CA7; Tue, 5 Jan 2021 14:42:29 +0000 (UTC)
Received: from localhost (holly.tpb.lab.eng.brq.redhat.com [10.43.134.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99C3B10016DB; Tue, 5 Jan 2021 14:42:26 +0000 (UTC)
Date: Tue, 05 Jan 2021 15:42:25 +0100
From: Miroslav Lichvar <mlichvar@redhat.com>
To: Magnus Danielson <magnus@rubidium.se>
Cc: ntp@ietf.org
Message-ID: <20210105144225.GH3008666@localhost>
References: <20210102081603.1F63C40605C@ip-64-139-1-69.sjc.megapath.net> <cecaf661-92af-8b35-4c53-2f025c928144@rubidium.se> <20210104164449.GE2992437@localhost> <b1e61f7d-6cea-5e99-69f0-7eae815d9e19@rubidium.se> <20210105083328.GA3008666@localhost> <ba5d2cde-6b5e-d9b6-1877-c4060bf43e80@rubidium.se>
MIME-Version: 1.0
In-Reply-To: <ba5d2cde-6b5e-d9b6-1877-c4060bf43e80@rubidium.se>
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22
Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mlichvar@redhat.com
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
Archived-At: <https://mailarchive.ietf.org/arch/msg/ntp/ix5jCXLsxMwe-SxyYxYbQlYWvZA>
Subject: Re: [Ntp] CLOCK_TAI (was NTPv5: big picture)
X-BeenThere: ntp@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: <ntp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ntp>, <mailto:ntp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ntp/>
List-Post: <mailto:ntp@ietf.org>
List-Help: <mailto:ntp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ntp>, <mailto:ntp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 05 Jan 2021 14:42:35 -0000

On Tue, Jan 05, 2021 at 03:10:55PM +0100, Magnus Danielson wrote:
> On 2021-01-05 09:33, Miroslav Lichvar wrote:
> > With hardware timestamping there is a separate (hardware) clock used
> > for timestamping. It's not related to the CLOCK_TAI system clock
> > discussed here.
> So, you are saying that the kernel sense of TAI is not used to control
> the time of the hardware clock? Fine, but some driver is doing that,
> because the hardware clock of a typical is very stupid and is controlled
> even with simpler forms than that for which the kernel clock is steered
> by NTPD over the nanokernel interface.

The kernel and driver have no idea in what timescale the hardware
clock is keeping time, if any. That's up to the applications. Unlike
with the system clock, there is no support for inserting/deleting leap
seconds, so it needs to use a non-leaping representation.

> Second challenge, if we have a TAI-like core format, and we indeed can
> rebuild a TAI replica, and we do not consider this enough, would a TAI
> format allows us to fairly cheaply adapt that to other formats? Turns
> out that this comes very cheap and is easy to do robust, if and only if,
> one has access to the TAI-UTC difference and information about an
> upcoming one as that eventually approaches.

Yes, that's the problem I'm trying to point out. The TAI-UTC offset is
not universally available, but it is required for conversion between a
leaping and non-leaping representation of time. It doesn't matter if
it is in the kernel, libc, or the NTP implementation. When I want to
synchronize two UTC clocks, which is probably the most common case,
there is no point in converting the timestamps to a non-leaping
representation and back. If it cannot be done reliably, as is the case
with current systems, it will just make the synchronization less
reliable.

-- 
Miroslav Lichvar