Re: Predictable Internet Time

Joe Touch <touch@isi.edu> Tue, 03 January 2017 23:28 UTC

Return-Path: <touch@isi.edu>
X-Original-To: ietf@ietfa.amsl.com
Delivered-To: ietf@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E0F961294BA for <ietf@ietfa.amsl.com>; Tue, 3 Jan 2017 15:28:51 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -10
X-Spam-Level:
X-Spam-Status: No, score=-10 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RP_MATCHES_RCVD=-3.1] 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 SxryVHwQR599 for <ietf@ietfa.amsl.com>; Tue, 3 Jan 2017 15:28:50 -0800 (PST)
Received: from boreas.isi.edu (boreas.isi.edu [128.9.160.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5604A1294B3 for <ietf@ietf.org>; Tue, 3 Jan 2017 15:28:50 -0800 (PST)
Received: from [128.9.160.211] (mul.isi.edu [128.9.160.211]) (authenticated bits=0) by boreas.isi.edu (8.13.8/8.13.8) with ESMTP id v03NS3Ij005459 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Tue, 3 Jan 2017 15:28:03 -0800 (PST)
Subject: Re: Predictable Internet Time
To: Tony Finch <dot@dotat.at>
References: <CAMm+LwgfQJ8aG5wB=d3fRbbeje3J9o7Z4_DCuP8DL88ouDeKzw@mail.gmail.com> <504e2cea0d1668c31486b05fec0a967a4446aefe@webmail.weijax.net> <CAMm+Lwi_jU6gjdtdM6a2n_9_89tUvWBNXxnMtSjTEA++h1D4Ew@mail.gmail.com> <e0a43370-751f-808c-3719-9716f9cd57d1@isi.edu> <alpine.DEB.2.11.1701031348430.7102@grey.csi.cam.ac.uk> <f94415b6-d9f7-0a03-cf5b-ce39c109aa71@isi.edu> <1483475689.1348946.836323865.09305276@webmail.messagingengine.com> <94226b19-4690-ee8e-526e-04cc54e97b8e@isi.edu> <1483482794.1375510.836410009.6D0F7910@webmail.messagingengine.com> <fef56705-3037-eb92-b804-4aa43326a654@isi.edu> <1483485260.1384841.836469129.669D4C7B@webmail.messagingengine.com>
From: Joe Touch <touch@isi.edu>
Message-ID: <ad31b4f2-7104-d951-3f5b-81cbfc83b118@isi.edu>
Date: Tue, 3 Jan 2017 15:28:03 -0800
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1
MIME-Version: 1.0
In-Reply-To: <1483485260.1384841.836469129.669D4C7B@webmail.messagingengine.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-ISI-4-43-8-MailScanner: Found to be clean
X-MailScanner-From: touch@isi.edu
Archived-At: <https://mailarchive.ietf.org/arch/msg/ietf/I2P9p5Q3I6naHMaJ4_uAEZoQ-ws>
Cc: Phillip Hallam-Baker <phill@hallambaker.com>, IETF Discussion Mailing List <ietf@ietf.org>
X-BeenThere: ietf@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: IETF-Discussion <ietf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ietf>, <mailto:ietf-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ietf/>
List-Post: <mailto:ietf@ietf.org>
List-Help: <mailto:ietf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ietf>, <mailto:ietf-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Jan 2017 23:28:52 -0000


On 1/3/2017 3:14 PM, Tony Finch wrote:
>
> Joe Touch <touch@isi.edu>; wrote:
> >
> > Leap seconds are still seconds, which are counted in "seconds since
> > epoch".
>
> Can you you show me where in the POSIX spec linked below leap seconds
> are counted? I thought they were not.

 A leap second is just a way to stall the UTC representation so it takes
61 seconds for a particular minute to pass, but the seconds still pass
and the seconds since epoch ought to increment accordingly.

The Posic spec describes how to convert seconds since epoch to UTC; it
is that conversion where leap seconds come into play.


>
> > >
> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_16
>
> > > $ perl -MPOSIX -e 'print strftime "%F %T\n", gmtime 1483228799'
> > > 2016-12-31 23:59:59
> > > $ perl -MPOSIX -e 'print strftime "%F %T\n", gmtime 1483228800'
> > > 2017-01-01 00:00:00
> >
> > In would presume that the same code would generate a time that is one
> > second behind UTC right now.
>
> I'm not sure what you mean. If you add (24+24+23)*3600 seconds
> to 1483228800 you get 23:00:00 today,

If 1483228799 is the correct number of TAI seconds since the Unix epoch
and if that accurately represents 2016-12-31 23:59:59, then 2017-01-01
00:00:00 should not have been output until 1483228801.

Since that wasn't accounted for, we are displaying a "Posix UTC" time
that is one second ahead of where UTC actually is.


>
> > I.e., the Posix code is incorrect in claiming it reports UTC.
>
> Yes, I agree.
>
> > NTP reports seconds since epoch; it is in the conversion of that value
> > to display time that the issue of leap seconds comes into play. In that
> > case, some systems report 59-59-00 and others 59-00-00, i.e, repeating a
> > UTC value to account for the leap second in the human-readble output.
> > Internally, the number of seconds which have passed is correct and
> > include the leap second.
>
> But if the count of seconds includes the leap second, surely the
> number representing the leap second could be printed properly as :60 ?

UTC defines it that way, so if you want to output the correct UTC value,
that is the only solution.

Any other solution - smear, repeating times (59-59-00 or 59-00-00) can
be generated, but would be incorrect relative to UTC.

Joe