Return-Path: <faye.github@gmail.com>
X-Original-To: cbor@mail2.ietf.org
Delivered-To: cbor@mail2.ietf.org
Received: from localhost (localhost [127.0.0.1])
	by mail2.ietf.org (Postfix) with ESMTP id BA1CB525B7F4
	for <cbor@mail2.ietf.org>; Sun, 10 Aug 2025 15:47:55 -0700 (PDT)
X-Virus-Scanned: amavisd-new at ietf.org
X-Spam-Flag: NO
X-Spam-Score: -2.098
X-Spam-Level: 
X-Spam-Status: No, score=-2.098 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, FREEMAIL_FROM=0.001,
	HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: mail2.ietf.org (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
Received: from mail2.ietf.org ([166.84.6.31])
	by localhost (mail2.ietf.org [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id gdSboRwDI90z for <cbor@mail2.ietf.org>;
	Sun, 10 Aug 2025 15:47:55 -0700 (PDT)
Received: from mail-ua1-x935.google.com (mail-ua1-x935.google.com
 [IPv6:2607:f8b0:4864:20::935])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256)
	(No client certificate requested)
	by mail2.ietf.org (Postfix) with ESMTPS id 60541525B7EC
	for <cbor@ietf.org>; Sun, 10 Aug 2025 15:47:55 -0700 (PDT)
Received: by mail-ua1-x935.google.com with SMTP id
 a1e0cc1a2514c-88e373c07f8so88116241.1
        for <cbor@ietf.org>; Sun, 10 Aug 2025 15:47:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20230601; t=1754866074; x=1755470874; darn=ietf.org;
        h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
         :date:message-id:reply-to;
        bh=VsTiUpdNCsYT7CQYaRdmCNiFe2JUCWDXMTc+Hq/hhDs=;
        b=bWmDadqVWq2YW+RNlGKPmhxkgjxqAcVTy5W6sv7zf39i2PQicQ3qEMnqfi2e6cTayd
         ExRqH3tIScy4MgPYRveahxq+DWiTsfHprBmYZyYy53Hd2NGT0rV/lGJPezRfxYO20Mzw
         BZ7ugFMvFAX6anbYC5Xac9OSYAat1X9pcofiRPzm4fZnwZjYjSgrMqMP126lLGF1qHtl
         Evaiz3lY3eo6+crCpH5aa2N5IHLRyw+rSsKymiLsYqLTSkeN+1ykA7D0mWdTS57lxngL
         8wNFjeFfG57YeWS8C8V6WFnp8yK0KfbVeWSjT4EazrfPfVVREOp/hnxRkhhJb2+/+a/h
         l9Fg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1754866074; x=1755470874;
        h=to:subject:message-id:date:from:mime-version:x-gm-message-state
         :from:to:cc:subject:date:message-id:reply-to;
        bh=VsTiUpdNCsYT7CQYaRdmCNiFe2JUCWDXMTc+Hq/hhDs=;
        b=LjPzG310pxDK4H4iAyeRhDB/REWcv0jgha1NsxrD88qwVc+wt+R+P/poJR4P8QpzMP
         MGtZLxogCTbvA8xZYXZqdsahWl1U58r5gpKEJEGrBSiFCaGoTadkMTokC5ag/1UqZRN6
         pQbXSvmDhIuz9P/dB0+mrTBKjJNPB3vYjIW+DUIqvt6XqjdWXz5T1QpqhMV5dQelW3Lm
         9TQfB4uo9G0ruLqnij91Mp5D4NXpfpDRJMXlolMFrrbh2MgJBJJUQ9n2XOGN747pqIkz
         Tni0zi1sNoFWykHbJoA7RRpIMo9PtXW8InRuFptBzkyxX8T8h04rsI7ieTYSeZertpHK
         uJUg==
X-Gm-Message-State: AOJu0YwJH3P5A9m/B48GMY/gSZNMKxFzsF0JdhQMTNfLuCkjqAgHEEzF
	OZGFkvcssFAnMa5fWXajPpZKGCB8E2Jl5X1+yz+1aOkUqOCv6Gq7j9Q1zbIW+U1IvEdyzXJfgIW
	PWrEpApZjFuLcRsnjjFCPWDzds1S+INp+Pd0xBq8=
X-Gm-Gg: ASbGncvJJjHZYzhaxpRDpdebcN/lZa4eU6pfjWTSNbzgbPLlQBPkF3kl613Wbr76xL4
	uyZ/OP8mgdE2OsS/Wj6T1uV15FumrPvwVLqB6j7fmi4lP8I4IWR9bq4HwlOc1/VOV4VazKgOkeG
	dUJ1ilDzyh+O5rt7NVnuH+tVizS0h+asVRhBxTkGAL1lSa1C8HKEs4mPbzvrOfwKiGw80psZnIf
	uaCrWqEKDPNM50ufA==
X-Google-Smtp-Source: 
 AGHT+IG63cx0RfurNgnc3BCpEZ4FGGoPcnQ19A0lu+KRBSHv6sZ7C8hLFXhW1jjKgbWMh1PxmWK32CZRp1vajNF/cjQ=
X-Received: by 2002:a05:6122:78d:b0:530:7ca2:449d with SMTP id
 71dfb90a1353d-53a52d6679fmr4082461e0c.3.1754866074465; Sun, 10 Aug 2025
 15:47:54 -0700 (PDT)
MIME-Version: 1.0
From: Faye Amacker <faye.github@gmail.com>
Date: Sun, 10 Aug 2025 17:47:43 -0500
X-Gm-Features: Ac12FXy1QyA17DeXQX7khWOf13HzuIZ-gsMua33O738D2qvTvuh2cheE7n_YUI0
Message-ID: 
 <CA+qCGhu55TzJRh6X5DMZ9n4e6basOwOBbstgo1QDsvLzF2nLzg@mail.gmail.com>
To: cbor@ietf.org
Content-Type: multipart/alternative; boundary="000000000000ff3a50063c0a98b0"
Message-ID-Hash: WK57XPPOJZTUCRH6NTOWM3BFGUJ5FLKZ
X-Message-ID-Hash: WK57XPPOJZTUCRH6NTOWM3BFGUJ5FLKZ
X-MailFrom: faye.github@gmail.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency;
 loop; banned-address; member-moderation; header-match-cbor.ietf.org-0;
 nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size;
 news-moderation; no-subject; digests; suspicious-header
X-Mailman-Version: 3.3.9rc6
Precedence: list
Subject: =?utf-8?q?=5BCbor=5D_Tag_for_Nanoseconds_Since_Unix_Epoch_in_Int64_Range?=
List-Id: "Concise Binary Object Representation (CBOR)" <cbor.ietf.org>
Archived-At: 
 <https://mailarchive.ietf.org/arch/msg/cbor/BFMhoPkeq8ibKg-4JRwQ78FaGC4>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Owner: <mailto:cbor-owner@ietf.org>
List-Post: <mailto:cbor@ietf.org>
List-Subscribe: <mailto:cbor-join@ietf.org>
List-Unsubscribe: <mailto:cbor-leave@ietf.org>

--000000000000ff3a50063c0a98b0
Content-Type: text/plain; charset="UTF-8"

Hello,

I maintain a generic CBOR codec[1] and collected some feedback/issues that
might be resolved by using a new CBOR tag (if approved).

Currently, CBOR can encode time with nanoseconds as:
- CBOR tag 0 with text string that is ~30 bytes long (vs ~8 bytes in other
formats)
- CBOR tag 1 with a floating point value that can be lossy (e.g., fails
round trip in fuzz tests and serialization format comparison tests)

A simple way to resolve these is by using a CBOR tag for nanoseconds
elapsed since Unix epoch as an integer in the range -2^63..2^63-1
inclusive.  This allows efficient and lossless encoding of nanoseconds
that can represent time from Sept. 1677 to April 2262.  The tag can be
applied to an unsigned integer (major type 0) or a negative integer (major
type 1).

I wrote a draft proposal[2] with more details. It includes "Rationale"
section with alternatives considered and an "Examples" section that
mentions considerations for negative values.

Thoughts?

[1] https://github.com/fxamacker/cbor
[2]
https://github.com/fxamacker/CBOR-Tag-Specs/blob/master/TimeUnixNanoInt64.md

--000000000000ff3a50063c0a98b0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hello,</div><div><br></div><div>I maintain a generic =
CBOR codec[1] and collected some feedback/issues that might be resolved by =
using a new CBOR tag (if approved).<br></div><div><div><br>Currently, CBOR =
can encode time with nanoseconds as:<br>- CBOR tag 0 with text string that =
is ~30 bytes long (vs ~8 bytes in other formats)<br>- CBOR tag 1 with a flo=
ating point value that can be lossy (e.g., fails round trip in fuzz tests a=
nd serialization format comparison tests)<br></div><div><br></div></div><di=
v>A simple way to resolve these is by using a CBOR tag for nanoseconds elap=
sed since Unix epoch as an integer in the range=20
-2^63..2^63-1 inclusive.=C2=A0 This allows efficient and lossless encoding =
of
 nanoseconds that=C2=A0can represent time from Sept. 1677 to April 2262.=C2=
=A0 The tag can be applied to an unsigned integer (major type 0) or a negat=
ive integer (major type 1).</div><div><br></div><div>I wrote a draft propos=
al[2] with more details. It includes &quot;Rationale&quot; section with alt=
ernatives considered and an &quot;Examples&quot; section that mentions cons=
iderations for negative values.</div><div><br></div><div>Thoughts?</div><di=
v><br></div><div>[1] <a href=3D"https://github.com/fxamacker/cbor">https://=
github.com/fxamacker/cbor</a></div><div>[2]=C2=A0<a href=3D"https://github.=
com/fxamacker/CBOR-Tag-Specs/blob/master/TimeUnixNanoInt64.md">https://gith=
ub.com/fxamacker/CBOR-Tag-Specs/blob/master/TimeUnixNanoInt64.md</a></div><=
div><br><br></div></div>

--000000000000ff3a50063c0a98b0--

