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

Martin Burnicki <martin.burnicki@meinberg.de> Tue, 05 January 2021 16:09 UTC

Return-Path: <martin.burnicki@meinberg.de>
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 6226D3A1076 for <ntp@ietfa.amsl.com>; Tue, 5 Jan 2021 08:09:56 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.36
X-Spam-Level:
X-Spam-Status: No, score=-2.36 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.262, RCVD_IN_DNSWL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=meinberg.de
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 rkcWjynS20uC for <ntp@ietfa.amsl.com>; Tue, 5 Jan 2021 08:09:54 -0800 (PST)
Received: from server1a.meinberg.de (server1a.meinberg.de [176.9.44.212]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E43003A100D for <ntp@ietf.org>; Tue, 5 Jan 2021 08:09:53 -0800 (PST)
Received: from srv-kerioconnect.py.meinberg.de (unknown [193.158.22.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by server1a.meinberg.de (Postfix) with ESMTPSA id 745E771C0F62; Tue, 5 Jan 2021 17:09:49 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meinberg.de; s=dkim; t=1609862989; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nUN0MzjvliJOJVvZQ7E/3wehHwR9T/WCO+BbcdJXc7I=; b=b31wroq/yCzftkEQG8aW6VcuusgXsYaFdVScJq9DqM3/j8kTziSqHifksemm/LX93ru7Ri ZH/oZ02HY+vtkwE3Hq5ZCBIbrBMNb/JhMCY6wIkqw/JQgU+q/hPyYdrmD3GX0TL9G3SK9f ffE2MBQ2kpynVqhiiRkoWSwBppWh1zAboJs2sZT9iK7rVgXAE8qkQjAHj2C4oTDdhqNjKw ybRWIDdx0Ufxj/KH8FIYaQAAd5VQxMRuDjMBdvM4o5fK7uakOaGYlEYPonpqXJzugeNzmN KpJsoddlCRAZXRIDwvJFnIH6mHhNBDHZrKEOavC6a5yHV9YlHYDeYqUz4m9ukQ==
X-Footer: bWVpbmJlcmcuZGU=
Received: from localhost ([127.0.0.1]) by srv-kerioconnect.py.meinberg.de with ESMTPSA (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)); Tue, 5 Jan 2021 17:09:47 +0100
To: Hal Murray <hmurray@megapathdsl.net>, Miroslav Lichvar <mlichvar@redhat.com>
Cc: ntp@ietf.org
References: <20210105124544.5EF5C40605C@ip-64-139-1-69.sjc.megapath.net>
From: Martin Burnicki <martin.burnicki@meinberg.de>
Organization: Meinberg Funkuhren GmbH & Co. KG, Bad Pyrmont, Germany
Message-ID: <f876a3ff-16ee-fc63-c27c-d5a3cb847a3d@meinberg.de>
Date: Tue, 05 Jan 2021 17:09:47 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0
MIME-Version: 1.0
In-Reply-To: <20210105124544.5EF5C40605C@ip-64-139-1-69.sjc.megapath.net>
Content-Type: text/plain; charset="utf-8"
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/ntp/8FhRqaG-8p1R4Y0YIFQPTC4iwHg>
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 16:10:02 -0000

Hal Murray wrote:
> 
> mlichvar@redhat.com said:
>> NTP is used for synchronization of various clocks. Most of them are based on
>> UTC. NTPv5 cannot support only TAI. 

I fully and strongly agree with Miroslav.

NTP isn't only used on Linux, which supports TAI time, and FreeBSD,
which doesn't support TAI right now but can easily be extended to
support it in the near future (if I have understood some earlier
messages correctly).

Instead, there are more operating systems like other Unix-like systems,
Windows, VxWorks, QNX, and last but not least embedded systems and IoT
devices which are not even mentioned here. In many cases at least the
latter won't even run a full-featured NTP daemon but some simple NTP
client software just to keep their system time basically synchronized so
that their logs etc. are based on a fairly accurate time, which is
UTC/POSIX or a local time derived from that.

In the past, moving from NTPv3 to NTPv4 was easy and could be done
seamlessly due to the (IMO very good) evolution of the protocol, e.g.
that the format of the base packet was unchanged and new features were
implemented using extension fields.

When the NTP daemon (at least the original implementation from ntp.org)
received a request from a v3 client, it just had to change the set the
version field in the response packet to v3 instead of v4 to keep v3
clients happy.

>From the point of view as a manufacturer of time server appliances this
is much easier to maintain than the mess we had with PTP, where v2
packets had a totally different layout than the original v1 packets. The
only thing that limited the impact of that change was that PTPv2
appeared soon after v1, and v1 wasn't much widespread at that time.

For NTP, things are different. There is a huge base of NTPv4
installations, and making NTPv5 basically compatible with v4 would IMO
strongly increase the acceptance of NTPv5.

Yes, I know that it *may be* possible to design the protocol new, from
scratch, without any compatibility with v4, but IMO this would just
keeping lots of folks from using it for a long time, so the question is
if this was really a better approach than taking care of compatibility.

> This is a tangled area.
> 
> I think that a TAI only NTPv5 protocol would be much cleaner and easier to 
> document.  Yes, I agree that we need a story for UTC, but the answer doesn't 
> have to clutter up an RFC for NTPv5.

Yes, of course. If you only care how easy it is to document it, you
could simply say that NTP provides TAI time stamps, and that's it. This
would leave all the problems of the details how to convert that to UTC
and/or local time to the implementers of the system timekeeping.

In my opinion it would make much more sense to keep the NTP base packet
compatible with v4 and maybe make some extension fields mandatory for
v5, for example some correction information that let the client derive
TAI from the timestamps, if required or supported.

IMO this would strongly increase the acceptance of a v5 protocol because
existing clients still can use the same server as new, full-featured v5
clients, which can derive TAI if they want or need it.

> All the kernel and/or libc need to convert TAI to/from UTC is the TAI-UTC 
> offset (a small integer) and the date of the next leap second, a flag for 
> insert/delete/none, and the valid-until date of the info.

And there needs to be an API call that returns the current TAI or
UTC/POSIX) time *plus* the associated UTC offset atomically, with an
execution time as short as possible.

If you have to call several API functions after each other, you know in
worst case the kernel could just step the time between the 2 calls, so
the result ing timestamp/offset pair would be inconsistent.

I know there is already the ntp_gettime() call available on some
systems, but if you have a huge number of clients, the execution time of
that function significantly reduces the performance of the NTP server.

> We could provide that data in an extension.  The same extension would allow a 
> NTPv4 server to provide clients with enough info to let current UTC based 
> kernels provide TAI and/or leap when appropriate.

Why not do it the other way round, and provide the time scale that is
required by default by the clients, and provide a way to derive TAI for
those who really need it?

Yo still have to keep in mind that if you use TAI, you need a reliable
source not only for leap second announcements but also for the current
TAI offset. The latter is not provided by all reference time sources,
e.g. DCF77 doesn't have it.

> We could provide code that lets systems process leap-seconds.list
> ntpd already does.

Yes, but "someone" has to provide the file, at some point.

> A copy of the leap seconds file is included by the Time Zone project and 
> distributed by IANA.  Most distros are already setup to keep the time zone 
> info up to date.  It should be simple for the leap file to go along for the 
> ride.  Debian already does it.

Except the versions that aren't updated anymore, or embedded of IoT
devices. This has been discussed many times before.

IMO it's a step back to force using TAI just because it can easier be
described because it just shifts the existing limitations to a different
location in the time synchronization chain.


Martin
-- 
Martin Burnicki

Senior Software Engineer

MEINBERG Funkuhren GmbH & Co. KG
Email: martin.burnicki@meinberg.de
Phone: +49 5281 9309-414
Linkedin: https://www.linkedin.com/in/martinburnicki/

Lange Wand 9, 31812 Bad Pyrmont, Germany
Amtsgericht Hannover 17HRA 100322
Geschäftsführer/Managing Directors: Günter Meinberg, Werner Meinberg,
Andre Hartmann, Heiko Gerstung
Websites: https://www.meinberg.de  https://www.meinbergglobal.com
Training: https://www.meinberg.academy