Re: [Cbor] Encoding Arbitrary Time Ratios

Thiago Macieira <thiago.macieira@intel.com> Mon, 05 April 2021 22:29 UTC

Return-Path: <thiago.macieira@intel.com>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id EC7D33A2A9D for <cbor@ietfa.amsl.com>; Mon, 5 Apr 2021 15:29:05 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.197
X-Spam-Level:
X-Spam-Status: No, score=-4.197 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] 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 BhgVF1kTl_Q5 for <cbor@ietfa.amsl.com>; Mon, 5 Apr 2021 15:29:01 -0700 (PDT)
Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id A2B423A2A9C for <cbor@ietf.org>; Mon, 5 Apr 2021 15:28:59 -0700 (PDT)
IronPort-SDR: sS6pKOD7nLhwA2riDMutZjhI9lIl4UwMui4YuvWGMmUphDm8H5FNQZXgGcxhvZ4VbuTdogGytL qw03bg+rxanw==
X-IronPort-AV: E=McAfee;i="6000,8403,9945"; a="173008362"
X-IronPort-AV: E=Sophos;i="5.81,307,1610438400"; d="scan'208";a="173008362"
Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2021 15:28:58 -0700
IronPort-SDR: IF574O2kNmVO2okmPKa/XMPn9GuwGlb7eU0HITGMWn3W5EcG3PBGJfGkwqaJskSGVTP1eyB/bs Ky9zIgxhiLUw==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.81,307,1610438400"; d="scan'208";a="420917702"
Received: from irsmsx605.ger.corp.intel.com ([163.33.146.138]) by orsmga008.jf.intel.com with ESMTP; 05 Apr 2021 15:28:57 -0700
Received: from tjmaciei-mobl1.localnet (10.251.24.87) by IRSMSX605.ger.corp.intel.com (163.33.146.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 5 Apr 2021 23:28:56 +0100
From: Thiago Macieira <thiago.macieira@intel.com>
To: Emile Cormier <emile.cormier.jr@gmail.com>
CC: cbor@ietf.org
Date: Mon, 05 Apr 2021 15:28:52 -0700
Message-ID: <2096114.vpHZ4K6Zy5@tjmaciei-mobl1>
Organization: Intel Corporation
In-Reply-To: <CAM70yxAvoZmURMZHNY3-pKceU0mPbny=-QRAEeEzM2P0pcYrAg@mail.gmail.com>
References: <CAM70yxBF2XeewhsXOGv06kTVitz1kNHkYLHGqm3gX0Vyc2c2YA@mail.gmail.com> <2403465.MzrCfxQRY8@tjmaciei-mobl1> <CAM70yxAvoZmURMZHNY3-pKceU0mPbny=-QRAEeEzM2P0pcYrAg@mail.gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"
X-Originating-IP: [10.251.24.87]
X-ClientProxiedBy: orsmsx603.amr.corp.intel.com (10.22.229.16) To IRSMSX605.ger.corp.intel.com (163.33.146.138)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/K6PUoCE-lVnV5CiGPD9dE_FhpAg>
Subject: Re: [Cbor] Encoding Arbitrary Time Ratios
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 05 Apr 2021 22:29:06 -0000

On Monday, 5 April 2021 15:09:37 PDT Emile Cormier wrote:
> Now, now, no need to get snarky. ;-)  I concede that ratios other than
> 86400:1 (days) or 1:10^3N are contrived examples and probably have no
> practical use over an interoperable protocol.
> 
[cut]
> I think dates expressed as a number of days since the epoch would also be
> useful. Tag 0 (date/time string) has a numeric counterpart under tag 1. I
> think tag 1004 (date string) should also have a numeric counterpart under
> one form or another.

I can accept indicating the number of days. I don't find that a particularly 
useful encoding, since it does little to save space, but does add complexity. 
I don't find saving 2 bytes because we can encode the whole number of days 
until June 2149 a compelling value.

> If tag 30 (rational number) were allowed to express time in seconds, it
> could be used to represent integral days with a range of +/-2^61 / 86400 =
> +/-26687997791825 days, which corresponds to +/-73069256156.73 years.
> That's 5.3 times the age of the universe.

Please don't require rational numbers or BigFloat to represent time. The only 
valid encodings should be integers and floating point, and maybe not even the 
latter.

> Of course, seconds since epoch (tag 1) could also be used to exchange a date
> as days*86400, but the semantics of the value (a date) would be lost.
>
> How about just a new tag for a date expressed as the number of days since
> the epoch? 

Semantically indicating a date without time would be far more valuable, 
regardless of how it gets encoded. Simply expressing a time point that happens 
to be midnight UTC on a particular date is not that. So I support this idea.

Similarly, it would be useful to have just a time within a day.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering