Re: [Cbor] Proposal for Date, Time and Time Zones

Carsten Bormann <cabo@tzi.org> Thu, 14 February 2019 13:52 UTC

Return-Path: <cabo@tzi.org>
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 B497413106D for <cbor@ietfa.amsl.com>; Thu, 14 Feb 2019 05:52:28 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.199
X-Spam-Level:
X-Spam-Status: No, score=-4.199 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, 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 Zzx7FlNNOcKc for <cbor@ietfa.amsl.com>; Thu, 14 Feb 2019 05:52:26 -0800 (PST)
Received: from mailhost.informatik.uni-bremen.de (mailhost.informatik.uni-bremen.de [IPv6:2001:638:708:30c9::12]) (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 539D212D84D for <cbor@ietf.org>; Thu, 14 Feb 2019 05:52:26 -0800 (PST)
X-Virus-Scanned: amavisd-new at informatik.uni-bremen.de
Received: from submithost.informatik.uni-bremen.de (submithost2.informatik.uni-bremen.de [IPv6:2001:638:708:30c8:406a:91ff:fe74:f2b7]) by mailhost.informatik.uni-bremen.de (8.14.5/8.14.5) with ESMTP id x1EDqHZv025357; Thu, 14 Feb 2019 14:52:22 +0100 (CET)
Received: from sev.informatik.uni-bremen.de (sev.informatik.uni-bremen.de [134.102.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by submithost.informatik.uni-bremen.de (Postfix) with ESMTPSA id 440d9s3KCnz1Br6; Thu, 14 Feb 2019 14:52:17 +0100 (CET)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <151a780241b54397bdcdaf06d04668b1@pdv-FS.de>
Date: Thu, 14 Feb 2019 14:52:16 +0100
Cc: "cbor@ietf.org" <cbor@ietf.org>
X-Mao-Original-Outgoing-Id: 571845134.412986-08414a26c3d19b2fa632814662030e99
Content-Transfer-Encoding: quoted-printable
Message-Id: <D6578BB5-289A-46F8-9019-7DCF2F470FBC@tzi.org>
References: <bd4d7f87e98b40d585eb7b4502d4b234@pdv-FS.de> <5105F5B3-258E-44B4-B756-2444BB336845@tzi.org> <151a780241b54397bdcdaf06d04668b1@pdv-FS.de>
To: "\"Richter, Jörg\"" <Joerg.Richter@pdv-FS.de>
X-Mailer: Apple Mail (2.3445.9.1)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/RdrFZ9_wes3qth2OD1h88efAQxY>
Subject: Re: [Cbor] Proposal for Date, Time and Time Zones
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: Thu, 14 Feb 2019 13:52:29 -0000

On Feb 14, 2019, at 13:49, Richter, Jörg <Joerg.Richter@pdv-FS.de> wrote:
> 
> The main motivation for date and time of day is to just represent 
> the semantic information.  Without a need to assign one or more points in time.

Right, that’s why I think they stand on their own.  But I still would like to understand the whole picture.
It would be nice if we could come up with a coherent narrative on when to use which of these tags.

> No one cares whether his birthday was 23, 24 or 25 hours long.  
> Opening hours of stock exchanges are also just represented as a pair of clock times.
> Of course, deriving concrete points in time requires always context information 
> like the time zone of the stock exchange. But this information should not be 
> part of the clock time.

There are applications that would prefer it to be.
However, other applications may not need it, and the proposed tags are fine for those.

> As I see it, tag 1001 is useful for points in time.  I find it particularly 
> good that decimal fractions can also be used. I am unsure about the negative
> keys. Don’t they do the same as a decimal fraction?

Yes, but they save having to combine full seconds and decimal fractions into a single number, which would be needed for bigdecimals (CBOR Tag 4).  Many UNIX times, as well as the Haskell time which actually motivated writing the draft, come in seconds/decimal fractions.

> And unusual scaling like 10^-7
> cannot be used as is.  (Which is as it happens our internal resolution of
> points in time and time of day)


If you don’t have split seconds/fractions, you can use Key 4.
If you do, and want to preserve the split, we could introduce Key -7.
Is that a common representation?
I’m familiar with using 10 MHz clocks for frequency references, but wasn’t aware of its use for time reference.
You could also use Key -9, at the cost of one multiplication by 100 (encoding) or division by 100 (decoding).

> I can't quite imagine how the concepts could be unified. Do you have an 
> idea in mind?  All 4 types (timestamp, date, time of day, time zone) are used 
> separately in our code.  To me it makes sense to represent them distinctly in CBOR.

It does.  We might want to use the contents of the timezone tag as a Key for Tag 1001 right away.

> About leap seconds: Now that I think about it, is tag 0 defined with leap seconds 
> or without?  This might pose a problem (for us).  Anybody know what other 
> encoders/decoders do?

Tag 0 and 1 use civil time, i.e., time based on UTC.  For Tag 1, this uses the weird Posix format where a leap second and its preceding second cannot be distinguished.  (This is not a problem for Tag 0, if used properly; many implementations of the RFC 3339 underlying Tag 0 will however map to Posix time internally and so will have idiosyncrasies around leap seconds.)

(I can’t answer the actual question: I don’t know whether you consider “with/without leap seconds” to be equivalent to UTC/TAI or the other way around; the terminology here is not very sharp.)

For Tag 1001, we intend to have a map key that indicates the time scale, which would then clearly include TAI as one option.  This is not in the draft yet because we want to discuss this with an actual user of atomic time.
We also have some quite positive feedback for including leap-second smeared time scales (but which ones?) as further alternatives.

>> I’m interested in where the two
>> different approaches would be used (and how to get the interval/periodic
>> event function into tag 1001-1003).
> 
> I think I understand 1001.  And I think the two are different semantic concepts.
> But I cannot find anything about tags 1002 and 1003.  The draft for 1001
> does not contain much information about it.  Is there another document somewhere?

The earlier versions of the draft contained a little more, which we have cut down for -02.
Again, we would like to nail these down based on input from actual users of the concepts of duration and interval (including their thinking about semantic dates and concepts such as leap seconds and time zone changes).

As a way forward, I wouldn’t mind including the new tags in the time-tag Internet-Draft, so we have a place where the consistent narrative mentioned above can be put.

Grüße, Carsten