Re: [Ntp] Antw: Re: Antw: [EXT] Re: Timescales

Magnus Danielson <magnus@rubidium.se> Thu, 10 December 2020 19:20 UTC

Return-Path: <magnus@rubidium.se>
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 5E4F33A11F4 for <ntp@ietfa.amsl.com>; Thu, 10 Dec 2020 11:20:21 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.099
X-Spam-Level:
X-Spam-Status: No, score=-2.099 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, HTML_MESSAGE=0.001, NICE_REPLY_A=-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=rubidium.se
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 ZRtyhHZkkTmT for <ntp@ietfa.amsl.com>; Thu, 10 Dec 2020 11:20:16 -0800 (PST)
Received: from pio-pvt-msa3.bahnhof.se (pio-pvt-msa3.bahnhof.se [79.136.2.42]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id A36BF3A11F1 for <ntp@ietf.org>; Thu, 10 Dec 2020 11:20:13 -0800 (PST)
Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa3.bahnhof.se (Postfix) with ESMTP id CE5563F391; Thu, 10 Dec 2020 20:20:11 +0100 (CET)
Authentication-Results: pio-pvt-msa3.bahnhof.se; dkim=pass (2048-bit key; unprotected) header.d=rubidium.se header.i=@rubidium.se header.b=ccg3BiA6; dkim-atps=neutral
X-Virus-Scanned: Debian amavisd-new at bahnhof.se
Received: from pio-pvt-msa3.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa3.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OByp5bP15h-U; Thu, 10 Dec 2020 20:20:10 +0100 (CET)
Received: by pio-pvt-msa3.bahnhof.se (Postfix) with ESMTPA id B2E143F311; Thu, 10 Dec 2020 20:20:09 +0100 (CET)
Received: from machine.local (unknown [192.168.0.15]) by magda-gw (Postfix) with ESMTPSA id 1710D9A004E; Thu, 10 Dec 2020 20:20:09 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=rubidium.se; s=rubidium; t=1607628009; bh=xjwz1zguuzB9XiRtg7gYfKeC1eNyifI5xWAEcQhu/Hk=; h=Cc:Subject:To:References:From:Date:In-Reply-To:From; b=ccg3BiA6B+PZlTZdBhSFKFS48Ur9a2ErM7ykyLMto5UxFM6LIzKguc5mgvd8zEuRq 0ou+PaW+4tw2757S+S9saugmjIzZ9yWYXCbnKNJI26bToaAk6SF//JrduX8OLX7xPU uL8bBO0783mKxh9YoHIYizZfRNZmtLuZYdkNeWgJSvgFDrD7Qnqr4FFii0RZSCyGrk FqDjns/ruguG4sId8khYBCCr2TWK+XJrFA/woBGODzactgY0JvOLlJGr39jE1IPys4 pbIWgBUbtzmV1dLsUH43n4cHyDBxHmeoSMSZrheZbHwyURG3rZiMRs8aQgJNt63gXI WdtLJNGAFBUXQ==
Cc: magnus@rubidium.se, NTP WG <ntp@ietf.org>
To: Warner Losh <imp@bsdimp.com>, Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de>
References: <20201209101830.7CB0240605C@ip-64-139-1-69.sjc.megapath.net> <20201209113003.GA2352378@localhost> <5FD0D13C020000A10003D6CB@gwsmtp.uni-regensburg.de> <9ad5edd1-8794-6b55-ff9d-187fc77481a2@rubidium.se> <5FD1C67F020000A10003D6FA@gwsmtp.uni-regensburg.de> <CANCZdfrn4K-xTx6zvaLFq0F3gYebf6rCFf_W25utJsH7WhZgQg@mail.gmail.com>
From: Magnus Danielson <magnus@rubidium.se>
Message-ID: <686a1c62-a9af-a37f-e5d0-61b352f3bba4@rubidium.se>
Date: Thu, 10 Dec 2020 20:20:07 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:78.0) Gecko/20100101 Thunderbird/78.5.1
MIME-Version: 1.0
In-Reply-To: <CANCZdfrn4K-xTx6zvaLFq0F3gYebf6rCFf_W25utJsH7WhZgQg@mail.gmail.com>
Content-Type: multipart/alternative; boundary="------------C061D7472E8D77D30FEACBE2"
Content-Language: en-US
Archived-At: <https://mailarchive.ietf.org/arch/msg/ntp/aApr677XaMKRmrEKiydAXwsB8Ng>
Subject: Re: [Ntp] Antw: Re: Antw: [EXT] Re: Timescales
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: Thu, 10 Dec 2020 19:20:22 -0000

Warner,

On 2020-12-10 08:27, Warner Losh wrote:
>
>
> On Wed, Dec 9, 2020, 11:56 PM Ulrich Windl
> <Ulrich.Windl@rz.uni-regensburg.de
> <mailto:Ulrich.Windl@rz.uni-regensburg.de>> wrote:
>
>     >>> Magnus Danielson <magnus@rubidium.se
>     <mailto:magnus@rubidium.se>> schrieb am 09.12.2020 um 14:44 in
>     Nachricht <9ad5edd1-8794-6b55-ff9d-187fc77481a2@rubidium.se
>     <mailto:9ad5edd1-8794-6b55-ff9d-187fc77481a2@rubidium.se>>:
>     > Ulrich,
>     >
>     > On 2020-12-09 14:29, Ulrich Windl wrote:
>     >>
>     >>> Relying on a separate source like the leap‑seconds file is not
>     always
>     >>> possible. The device may not have an up‑to‑date OS, or
>     actually have
>     >>> any writable memory to store that information.
>     >>>
>     >>> There is definitely not a plenty of warning. Some reference clocks
>     >>> give the leap announcement only an hour before it happens (e.g.
>     >>> DCF77). Even delaying setting of the kernel leap status to the
>     clock
>     >>> update can be a problem if you are polling at 1024 seconds and
>     have
>     >>> more than two measurements dropped in a row in the clock filter.
>     >> However you could see the leap indication flag also as "leap
>     confirmation"
>     >> flag (actually there will be a leap event). With only DCF-77
>     clocks this
>     > could
>     >> be a problem. As said earlier, it would be best if NTP could
>     reliably
>     > transfer
>     >> the leapsecond table, or at least the relevant part of it to
>     make clients
>     > know
>     >> in advance that and when a leap event is scheduled.
>     >
>     > A mechanism that works well conveys the current value, when an
>     upcoming
>     > event is occurring and which direction it will be. That solves
>     most of
>     > the practical problems. For back-dating purposes, which is more
>     of an
>     > obscure corner-case, being able to also provide older parts of the
>     > leap-second history is nice, but rarely very useful.
>     >
>     > A less useful but still helpful mechanism is when there is a
>     pre-warning
>     > mechanism of upcoming event and indication when the event
>     occurs. For
>     > this to fully function the current value needs to be supplied
>     from the
>     > side, but from then the updates can be done correct if the node is
>     > operational during the pre-warning interval. The strength in
>     providing
>     > the current value directly is that you instantly can be "on the
>     right
>     > page, eh second" and the strength of the pre-warning system is
>     that you
>     > in advance can know of the leap second. In GPS for instance, you
>     have in
>     > practice over 5 months of pre-warning, and you get an indication
>     of when
>     > the event will occur so you can even be non-operational during
>     the event
>     > and as you wake up instantly provide the correct value even if the
>     > current value update can be slugish (12.5 min cycle for
>     transmission).
>     >
>     > So, a good and simple mechanism is to give the current TAI-UTC
>     offset,
>     > then have a flag indicating up-coming leap-second event, give the
>     > system-timestamp for when this event occurs and the TAI-UTC
>     offset as
>     > result of that leap-second insertion.
>     >
>     > Piggybacking a historic leapsecond file transfer will always be
>     a nice
>     > feature, but not strictly required if this is in place.
>
>     Hi!
>
>     That's why I wrote "or at least the relevant part of it", meaning
>     whether
>     there will be a leap event withing the next six months or not.
>     That's deinitely
>     not a lot of data. The only reason to send the full table would be
>     having to
>     avoid parsing the table before sending.
>
>
> Technically, a leap second can happen at the end of any month. It
> would be foolish to bake the 6 month thing in. Even so, the entire
> leap second table can be encoded in less than 100 bits today. Less if
> you get a bit clever with compression.
>
> I do agree that you can compress the relevant bit to 1 in the steady
> state once you know. But for discontinuous operation you need more to
> fully implement UTC, including correct reckoning of elapsed time
> between two events. Declaring these sorts of problems as outside the
> scope is why I make comments like bastard step child. Or put another
> way: if they were properly implemented, we'd have no need for smearing...
>
To extend your discussion with an example when it fails:

In the HP Z3801A GPSDO clock, the Motorola GPS OEM module flips a flag
to indicate that there is an upcoming leap-second. You can read out of
the OEM module when the leap-second occurs. However, the firmware choose
to interpret this to be in the last month of the UTC quarter, which is
secondary choice position in the ITU-R specification of time
transmissions. Now, as IERS chooses to only use the primary choice
position, that is end of june and end of december, and IERS publish
their decision just a few days after half-year, and the fact that the US
Air Force operation of the GPS constellation chooses to insert the
upcoming leap second typically within a few weeks of the IERS
annuncement, this means that the indication flag for leap second occurs
in two quarters, so the Z3801A will insert it in the wrong quarter. This
despite the availability of the correct time-stamp, which is a pure
software bug.

This is a great example how you should not interpret the flag value to
have implied time-meaning. You have two sets of specification, two
controlling organizations, two different vendors of equipment integrated
together. There is good chance things gets done the wrong way.

> Exchanging the metadata about UTC (or whatever timescale) is needed to
> completely implement it. Time exchange needs to be thought of as more
> than just a phase delta measurement.

Agreed. We learned this from bitter experience. We have seen severe
problems and we had to completely decommission equipment from operations
because of it.

Just do a very strict and clear design. It still cost a few bits, but it
ends up producing more transparent and robust mechanisms, that can be
adapted to the changing situation.

Cheers,
Magnus