Re: [Ntp] Leap second draft

Warner Losh <imp@bsdimp.com> Fri, 24 January 2020 15:42 UTC

Return-Path: <wlosh@bsdimp.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 ECC511200B6 for <ntp@ietfa.amsl.com>; Fri, 24 Jan 2020 07:42:32 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.897
X-Spam-Level:
X-Spam-Status: No, score=-1.897 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=bsdimp-com.20150623.gappssmtp.com
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 G43R2D7duxkZ for <ntp@ietfa.amsl.com>; Fri, 24 Jan 2020 07:42:31 -0800 (PST)
Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) (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 04948120090 for <ntp@ietf.org>; Fri, 24 Jan 2020 07:42:30 -0800 (PST)
Received: by mail-qk1-x72b.google.com with SMTP id 21so2442021qky.4 for <ntp@ietf.org>; Fri, 24 Jan 2020 07:42:30 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CFV4WJTPaCLvLuGJ6SlIRXoSGOXsV6+p/faGVADoSnw=; b=Ac7vcpIlfe20N+B+4kLTR1m0IKVxnY5vQxijog1qSSMmIf7EjwQU2aOuJ+jSpQQgf2 nU7iRlM/uMRa2M/lnopQCX3o/7yrBriV2ia8KegI8iALnrLi0ZAaWprorW4OnySwlWBX LoGJQOAWOlLOzMvyHX3sQgbO2Jo2BxHvPDPhJJFEl7ajQWasp6C7ypjXLLVKlyUIRMLg tAKgftHJpYisLuOdtkj2c63miAR61Vyt037r3JqzdC0jQjm8az85Ex3sQFnlgvybjBVh m+iXCad45UvZbD/Wc0TN4wflgk3dQdeKp0fknwirI/YPnGGa6eUDAs9yBTBvwvH7ukpI /M7A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CFV4WJTPaCLvLuGJ6SlIRXoSGOXsV6+p/faGVADoSnw=; b=BYl98uWPVSpkKO7RfnrpQvPyw8R/L48/5SaYwJ+PdqyjogBeA5QQh33rxrzxksygoR OmEtM8TyaGP60lMnGt5wDGBZLHiyMwoXG/Qr74LskhaZn7kHCk1wwEbYJ9MP/EyrqLSB HrjvKdiMvpZtUu0TCKolHE5Ck6XdMjBUj2LeF8DBbjPX0nWjrHmvOAe0DIbxd9wYRYV1 OrXmKhJk/WOP0m65WFZ5wujMiP+bJH9vztkjsUSNaK26d4cKXrRDEwbDfCF91eatGDC3 N0S+rKfpX1jFJInXbWPqtaR6bnjlYVerx7xNI/RCqxK4hO7UjCAEeEzTSwvVikbFjJox PTKw==
X-Gm-Message-State: APjAAAWy2fZYcriCXaBILl1O+F8vtJQ7laOpY2tyZ7EcvK7KBolxewa1 KsX6LixeUebAZAoN11DMXCJUjvHNioLrW7rR2QmqqyNh
X-Google-Smtp-Source: APXvYqzNYJGeb7JjUwXSWUt3+hkO2v92Rfoba4nTDg/4lLZRSw3uhaZ4of5dToLatveo5vZrkQ1GYLrX+3EGcPTiX3A=
X-Received: by 2002:ae9:c106:: with SMTP id z6mr3117756qki.380.1579880549932; Fri, 24 Jan 2020 07:42:29 -0800 (PST)
MIME-Version: 1.0
References: <CAJm83bD5Ozkpg5TpkogOW6xeeNQL3ZziLO9URM7haqN8Wrp=Wg@mail.gmail.com> <CACsn0cmZkRifrnbVbPw2=9ww+ttmbAGCW39LhT+jhDLLyU8e+A@mail.gmail.com> <CANCZdfo_cbo3UngOWEc4mM4_nLK=J81zSiF0shvsu5mENUGPMw@mail.gmail.com> <CANCZdfo-OW7d454Qqo9eqfOpw367A4gg4-2UJ5XdC=n0u_t+BQ@mail.gmail.com> <F7D6BF99-260C-467B-9AF7-94F1F5E2721B@frobbit.se> <CANCZdfoh0dTDLeJtJHaVtdSnpTc-jzc+nSUk2qDzrFcGr7=zfg@mail.gmail.com> <01C94076-A916-42F8-8BA7-8AE8C4AB71D2@frobbit.se>
In-Reply-To: <01C94076-A916-42F8-8BA7-8AE8C4AB71D2@frobbit.se>
From: Warner Losh <imp@bsdimp.com>
Date: Fri, 24 Jan 2020 08:42:18 -0700
Message-ID: <CANCZdfqDqYdP+Z9ais3puWqoKJz0DbjmUCPn5gkSYNo=VX-Meg@mail.gmail.com>
To: Patrik Fältström <paf@frobbit.se>
Cc: Watson Ladd <watsonbladd@gmail.com>, NTP WG <ntp@ietf.org>, Daniel Franke <dfoxfranke@gmail.com>
Content-Type: multipart/alternative; boundary="000000000000f769ec059ce49aa4"
Archived-At: <https://mailarchive.ietf.org/arch/msg/ntp/_Fr7xXPkp-MxwdT5n_2l-pK3KmE>
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: Fri, 24 Jan 2020 15:42:33 -0000

On Fri, Jan 24, 2020 at 7:45 AM Patrik Fältström <paf@frobbit.se> wrote:

> On 24 Jan 2020, at 15:12, Warner Losh wrote:
>
> > No. That is wrong. The numbering of the leap second is undefined. This
> is one way to resolve the issue, but it is not the only way. You will not
> find this specified, except indirectly via math on the struct tm, which
> isn't definitive about what to do during the leap.
>
> What I see are two things. First the math:
>
> > If the year is <1970 or the value is negative, the relationship is
> undefined. If the year is >=1970 and the value is non-negative, the value
> is related to a Coordinated Universal Time name according to the C-language
> expression, where tm_sec, tm_min, tm_hour, tm_yday, and tm_year are all
> integer types:
> >
> > tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86400 +
> >     (tm_year-70)*31536000 + ((tm_year-69)/4)*86400 -
> >     ((tm_year-1)/100)*86400 + ((tm_year+299)/400)*86400
>
> Then the definition of tm_sec which can have values [0,61].
>
> So far, so good, and the number of seconds in a day with an added leap
> second will then be 86401, and the first second of the following day (the
> following second) will have the same value.
>
> Where I agree with you that the leap second is undefined is the plain text
> which says:
>
> > As represented in seconds since the Epoch, each and every day shall be
> accounted for by exactly 86400 seconds.
>
> This implies that even if the math gives 86401 seconds (including the fact
> tm_sec can have a value of 61), the value 86401 seconds in a day is not
> valid.
>

Yes. It's ambiguous. A POSIX time_t is not defined at the leap second. You
could use your math to get one answer. However, that answer, back
translated to a struct tm gives the wrong day, so is also incorrect. In
POSIX land, leap seconds don't exist, and any definitive statement about
the 'proper' time_t encoding for a leap second cannot be made. It's
undefined.

Warner