[Ntp] Timescales, leapseconds and smearing

Kurt Roeckx <kurt@roeckx.be> Mon, 07 December 2020 22:27 UTC

Return-Path: <kurt@roeckx.be>
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 A681E3A0C45 for <ntp@ietfa.amsl.com>; Mon, 7 Dec 2020 14:27:41 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
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 u526JT1GxYia for <ntp@ietfa.amsl.com>; Mon, 7 Dec 2020 14:27:39 -0800 (PST)
Received: from excelsior.roeckx.be (excelsior.roeckx.be [IPv6:2a05:7300:0:100::3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E0ADE3A0C0F for <ntp@ietf.org>; Mon, 7 Dec 2020 14:27:38 -0800 (PST)
Received: from intrepid.roeckx.be (localhost [127.0.0.1]) by excelsior.roeckx.be (Postfix) with ESMTP id 04ACDA8A006C for <ntp@ietf.org>; Mon, 7 Dec 2020 22:27:36 +0000 (UTC)
Received: by intrepid.roeckx.be (Postfix, from userid 1000) id CA0001FE0DE1; Mon, 7 Dec 2020 23:27:35 +0100 (CET)
Date: Mon, 07 Dec 2020 23:27:35 +0100
From: Kurt Roeckx <kurt@roeckx.be>
To: ntp@ietf.org
Message-ID: <X86sVykHUqlkXP96@roeckx.be>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
Archived-At: <https://mailarchive.ietf.org/arch/msg/ntp/LzXz8QgLJ5ShStfpPDtFHab-v1o>
Subject: [Ntp] Timescales, leapseconds and smearing
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: Mon, 07 Dec 2020 22:27:50 -0000

We have various timescales people might care about:
- NTP
- TAI
- Smeared NTP
- UT1
- UTC
- UNIX time
- TT
- GPS
- Others

There are relations between those time scales, some are fixed,
others not.

The proposed draft has support for the first 4, and offsets
between some of them. Note that it calls the NTP timescale
UTC, which it's not.

One problem that NTP currently isn't very good at is dealing with
the leap second. The current draft proposal doesn't address the
problems. The major problems with it are:
- The NTP timescale is non-continues in case of a leap second,
  without an indication of on which scale you are. It also
  doesn't define which second should get repeated. This means there
  is a 2 second window where it's unclear what the time is.
- There is a need to distribute information about when a leap second
  will happen, which for can happen over NTP or some other way.
  Experience shows that a lot of NTP servers get this wrong,
  resulting in synchronization problems when some servers change
  and others not. When distributed over NTP, a majority of the
  servers need to indicate that it will happen. There is no way
  to indicate that you don't know a leap second will happen or
  not, making it harder to get it correct.

You can fix the first problem by moving to a scale that is
continues, like TAI. But I'm not sure if it's better or worse
because of the 2nd problem, it will probably be about the same.
In TAI it would always be clear what the time means, even if some
servers know about the leap seconds and others not. It would avoid
marking some servers as false tickers. The current proposed draft
supports working in TAI and smeared NTP. I'm not sure about the
UT1 scale in the draft but assume it's non-continues.

An other way to fix the non-continues problem is to have some
indication of on which scale you are. It needs to be able to say
in which scale each of the timestamps is. The proposed draft has a
TAI-UTC offset if you use the NTP scale that could be used for this,
but it would then apply to both timestamps. If that is what we
want to do, it needs to be more clear. But for the UT1 scale there
is no way to indicate it.

NTP could distribute information about difference between
timescales. A leap second will change the offsets, so we already
do this in a very limited way. TAI-UTC and UT1-UTC are mentioned in
the proposed draft, but it depends on which timescale you're using
which offset you can get. I'm not sure NTP is the best way to
distribute it. But for a lot of devices NTP is the only source of a
leap second information.

The document also has a smeared NTP option. It doesn't actually
say which time you put in the fields, the NTP time, or the smeared
NTP time. It then has an offset to the NTP time, without being
clear about the sign. The offset is also optional, which means you
might not be able to combine servers that smear, that smear
differently and that don't smear.

I'm currently not sure if we should do something with smearing. We
could for instance say that even if the server is smearing, NTP
should always contain unsmeared time, and that smearing is an
implementation detail. Or we could standardize how it should be
smeared. Or like the current draft that you have smear offset.


Kurt