Re: [Ntp] Timescales, leapseconds and smearing

Martin Burnicki <martin.burnicki@meinberg.de> Tue, 08 December 2020 18:02 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 0DDC53A10CF for <ntp@ietfa.amsl.com>; Tue, 8 Dec 2020 10:02:02 -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 jJ9bNk_DhyUx for <ntp@ietfa.amsl.com>; Tue, 8 Dec 2020 10:01:59 -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 A82453A1082 for <ntp@ietf.org>; Tue, 8 Dec 2020 10:01:58 -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 E5D2C71C040B; Tue, 8 Dec 2020 19:01:55 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meinberg.de; s=dkim; t=1607450516; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w3p3b6NogHfjVs7+VB+MsjEB1Cl82NM1ClnTa1z6NIE=; b=SQiPv1nTbDtfRVzuJEJ8qmDsRXQkysQC+oI607FtqgaIw8JYcBh5+y63rre/JABG9cOYcp J7kcelGQMxD0rCDy3cGgeWn3kkrxTzoebqViXg74muROr+6G4tF+G6lABkxGkYfVwiq0Jp VhcOZ7tcQrT0u2fl/JrTfu7V0fDrh6xkp9RtBmUg8/4x9Jt3GjphEqv4KHX22myYUDu18t rDleixrKeZrtCERNodHzgcNgbnPuYqEWTfkjoRjw2sW6jom+7qnVRHavDsUNVeRYCUkO67 uijl5JI47vQH+luZHHPAo3V3tqe/VE9i99n6pmjd03d6oHKbKH4Rn+r8xGCWRw==
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:01:53 +0100
To: Kurt Roeckx <kurt@roeckx.be>, ntp@ietf.org
References: <X86sVykHUqlkXP96@roeckx.be> <X863Hy2DA7LuHCzb@roeckx.be>
From: Martin Burnicki <martin.burnicki@meinberg.de>
Organization: Meinberg Funkuhren GmbH & Co. KG, Bad Pyrmont, Germany
Message-ID: <1c7f9971-8aa7-12b9-194a-48a2f9e78819@meinberg.de>
Date: Tue, 08 Dec 2020 19:01:52 +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: <X863Hy2DA7LuHCzb@roeckx.be>
Content-Type: text/plain; charset="utf-8"
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/ntp/8ULdnjSlPeQxd0H_bckK7BXByds>
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:02:10 -0000

Kurt Roeckx wrote:
> On Mon, Dec 07, 2020 at 11:27:35PM +0100, Kurt Roeckx wrote:
>>
>> 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.
> 
> One thing I forgot to mention is that if there can be doubt about
> what the timestamp field means, the packet could just be dropped,
> so from 1 second before the leap second, to 1 second after the
> leap second, for a total of 3 seconds.

AS said earlier, ntpd from ntp.org does this. It sets the leap bits to
"unsynchronized" so the client sees that it gets a reply, but (with
usual poll intervals) a single reply to be dropped.

This avoids huge time offsets that could occur e.g. if the kernel steps
the time back just after the server has grabbed a receive timestamp for
a request, and before it grabs another timestamp as the transmit time.

>> 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.
> 
> I guess that should say current leap second information. There is
> of course a class of devices that should use SNTP and so don't
> really care about the leap second. But there probably are also
> devices that do care about it, have the option to get it, but
> don't get it.

As far as I can tell, most NTP clients just run fine if they receive a
leap second warning from the server early enough.

What happens at the client side if the kernel just steps the time back,
and if e.g. databases get a hickup because the time is stepped back is
IMO a problem of the operating system and the applications, which in
fact goes back to the deficiencies of the POSIX time specification.


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