Re: [Ntp] Timescales, leapseconds and smearing

Martin Burnicki <martin.burnicki@meinberg.de> Tue, 08 December 2020 18:18 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 96AF13A1086 for <ntp@ietfa.amsl.com>; Tue, 8 Dec 2020 10:18:51 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.1
X-Spam-Level:
X-Spam-Status: No, score=-2.1 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.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 YQ5BZKW1eDkO for <ntp@ietfa.amsl.com>; Tue, 8 Dec 2020 10:18:49 -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 7CC6A3A1083 for <ntp@ietf.org>; Tue, 8 Dec 2020 10:18:49 -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 10C2F71C10EE; Tue, 8 Dec 2020 19:18:45 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meinberg.de; s=dkim; t=1607451525; 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=EMXzkYGhS4joIHbCxbYwRfUlfO895V/5jE8vt9+c2mA=; b=DbXn2RJg62pV+liR1TClziRDd1E36qyiCVKJHcGFWU1q0zo3kJn5Yfgx9Z9tXRyzD4lGCF 2jND8+xwvpHUHDxyAvk7U12zE3C5H4XEbcwRc/wEOcYuUMIrVoke91DeCkhapU8Y3vcCfd n37mTTwX7OKoQoFpzsySNM5Klnaid1k85ew3RifLHrgxu0AqYUiatSHNSr6hvT8qVzlt0X vfAw1AUFwTOSQeDVHNExj5yG1bLZXWdPcZ+DJum1KDFKZtnzkdE/Oxw1Fq2uTAC+vAWll2 Fhl/8Ow4RIyJwOyt7wGgm4WjLPdG3Vsmidzt1xs3k8U5wSi4AJTbG1iHBYdpUQ==
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, 8 Dec 2020 19:18:40 +0100
To: Miroslav Lichvar <mlichvar@redhat.com>, Kurt Roeckx <kurt@roeckx.be>
Cc: ntp@ietf.org
References: <X86sVykHUqlkXP96@roeckx.be> <20201208093104.GR2352378@localhost>
From: Martin Burnicki <martin.burnicki@meinberg.de>
Organization: Meinberg Funkuhren GmbH & Co. KG, Bad Pyrmont, Germany
Message-ID: <01551d73-8fb9-64e0-d0b1-81ae59986ba7@meinberg.de>
Date: Tue, 08 Dec 2020 19:18:40 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0
MIME-Version: 1.0
In-Reply-To: <20201208093104.GR2352378@localhost>
Content-Type: text/plain; charset="utf-8"
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/ntp/dDyIxYUM7TEHYHuff3Eokmf82ig>
Subject: Re: [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: Tue, 08 Dec 2020 18:18:52 -0000

Miroslav Lichvar wrote:
> On Mon, Dec 07, 2020 at 11:27:35PM +0100, Kurt Roeckx wrote:
>> 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.
> 
> How do you suggest it should be called?

In fact, it's like POSIX time but with a different epoch. Is POSIX time
UTC? ;-)

I've seen other programming environments where time_t directly returned
seconds since 1900, not 1970. If I remember correctly, LabWindows CVI is
such a system.

>> - 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.
> 
> That's a good point. It would help have a special value, or a flag,
> for the unknown case.

In the past, the reason for the problems with leap second announcements
were firmware bug in GPS receivers (or in ntpd in one case).

So when would that special value be used?

In case if a leap second file is available, but has expired?

In case a GPS receiver is used but it is impossible to retrieve the leap
second/TAI info from the receiver? For example, as far as I know there
is no NMEA sentence that transports the leap second / TAI information
that is available inside the receiver.

>> 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.
> 
> The draft says the offset is for the receive timestamp. The client can
> calculate it for the transmit timestamp in the non-ambiguous
> timescales.
> 
> If the client cares about the ambiguity, it should use a non-ambiguous
> timescale. Of course, both server and client need to support that.
> Clients using ambiguous timescales can be recommended to ignore any
> measurements around the leap second, as some current implementations
> do.
> 
>> 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.
> 
> We should consider the reasons why server leap smearing is currently
> used. I think the main one is that most NTP clients cannot be
> configured to correct the clock for a leap second by a controlled
> slew. If they could do that, there would be no need to do it on the
> server.
> 
> If NTPv5 had a special leap-smeared timescale, would be the clients
> actually updated to request it? I doubt it.

I agree. As mentioned earlier, this is used to send faked time to the
clients to totally hide the leap second.

If a client was aware that it couldn't handle a leap second properly, it
could do the smearing by itself, locally.

Using a smearing server makes thing easier because there's only the
server that needs to be modified, and all clients of that server behave
in the same way.

> Maybe it would be better to just have a single flag for the server to
> announce it is implementing a leap-smear. Clients could at least
> detect mixing of smearing and non-smearing servers and better handle
> the case when it knows about the leap second from a separate source.

As said earlier, ntpd from ntp.org already sends a special refid while
sending smeared time, so "intelligent" clients already could detect and
compensate the smearing.


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