Re: [Ntp] Leap second draft

Miroslav Lichvar <mlichvar@redhat.com> Mon, 01 April 2019 13:03 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 1DAC812010E for <ntp@ietfa.amsl.com>; Mon, 1 Apr 2019 06:03:02 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.901
X-Spam-Level:
X-Spam-Status: No, score=-6.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, 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 cFGk3evHvzbB for <ntp@ietfa.amsl.com>; Mon, 1 Apr 2019 06:02:56 -0700 (PDT)
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 244C0120116 for <ntp@ietf.org>; Mon, 1 Apr 2019 06:02:51 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8996EC066445; Mon, 1 Apr 2019 13:02:46 +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 D40155D70E; Mon, 1 Apr 2019 13:02:45 +0000 (UTC)
Date: Mon, 01 Apr 2019 15:02:44 +0200
From: Miroslav Lichvar <mlichvar@redhat.com>
To: Daniel Franke <dfoxfranke@gmail.com>
Cc: ntp@ietf.org
Message-ID: <20190401130244.GD12525@localhost>
References: <CAJm83bD5Ozkpg5TpkogOW6xeeNQL3ZziLO9URM7haqN8Wrp=Wg@mail.gmail.com> <CAJm83bCbVzO3NNCbjTy+O_16T7DBeA7O6018WWGu_-GyuN-8UA@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <CAJm83bCbVzO3NNCbjTy+O_16T7DBeA7O6018WWGu_-GyuN-8UA@mail.gmail.com>
User-Agent: Mutt/1.10.1 (2018-07-13)
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 01 Apr 2019 13:02:49 +0000 (UTC)
Archived-At: <https://mailarchive.ietf.org/arch/msg/ntp/Sa3frshBcVqRpidh25meN9wmUK8>
Subject: Re: [Ntp] Leap second draft
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, 01 Apr 2019 13:03:02 -0000

On Fri, Mar 29, 2019 at 08:57:42PM +0100, Daniel Franke wrote:
> 1.2.  The Leap Indicator field
> 
>    NTP packets include a Leap Indicator field which warns receivers of
>    an upcoming insertion or deletion of a leap second.  [RFC5905]
>    specifies that this field warns "of an impending leap second to be
>    inserted or deleted in the last minute of the current month".

RFC 5905 actually says both "current month" and "current day". I think
the leap field was supposed to be compatible with NTPv3 (it's not
mentioned in the RFC as an incompatible change - unlike the refid
field) and both instances in the document should say "day". I've
submitted an errata for this couple years ago.

>    The Era Number subfield gives the era number of the Receive
>    Timestamp.  The Reference Timestamp always precedes the Receive
>    Timestamp, and the Transmit Timestamp always succeeds the Receive
>    Timestamp.

I don't think this is always the case. It's not required by RFC 5905.

Some reasons for a TX timestamp not being after RX:
- low-precision clock (randomization of low-order bits may, but
  doesn't have to enforce the order of generated timestamps)
- clock stepped between RX and TX (e.g. in symmetric mode)
- very simple server using a single timestamp for both TX and RX
- interleaved mode (in this case it would be unusual to see RX < TX)

>       F: When set, indicates that the Reference Timestamp was captured
>       during a leap second.
> 
>       R: When set, indicates that the Receive Timestamp was captured
>       during a leap second.
> 
>       X: When set, indicates that the Transmit Timestamp was captured
>       during a leap second

This sounds nice, but I'm curious if it can actually be implemented on
current systems. One issue is that the system clock may not be stepped
exactly at 00:00:00.000000000. It may happen few microseconds or even
milliseconds later.

Timestamps captured by ntp_gettime(), which gives also the clock
status code, could be better at least in theory, but it may be much
slower than clock_gettime() and there is no way to get this
information for timestamps captured by the kernel (e.g. with the
SO_TIMESTAMP socket option).

To me it would make more sense to specify that clients should ignore
any measurements that have a timestamp that is too close to the leap
second and servers should respond with "unsynchronized" leap bits
around leap second. Some implementations already do this.

-- 
Miroslav Lichvar