[systemd-devel] Antw: [EXT] Question about timestamps in the USER_RECORD spec

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Thu Oct 28 07:21:12 UTC 2021


>>> Arian van Putten <arian.vanputten at gmail.com> schrieb am 26.10.2021 um 10:41 in
Nachricht
<CAE0h1269nSwDOGJc9BKMRRc2dtVJXZVHNZkzCpCQFVddfYGvXQ at mail.gmail.com>:
> Hey list,
> 
> I'm reading the https://systemd.io/USER_RECORD/ spec and I have a question
> 
> There are some fields in the USER_RECORD spec which are described as
> "unsigned 64 bit integer values".   Specifically the fields describing
> time.
> 
> However JSON lacks integers and only has doubles [0]; which would mean 53

That's nonsense: JSON _has_ integers, but they are restricted (See: 6.  Numbers in RFC 7159)

int = zero / ( digit1-9 *DIGIT )

That was some stupid design decision IMHO.

> bit integer precision is about the maximum we can reach.  It's unclear to

The RFC mentions "IEEE 754-2008 binary64 (double precision) numbers"

> me from the spec whether I should use doubles to encode these fields or use
> strings.  Would it be possible to further clarify it?   If it is indeed a
> number literal; this means the maximum date we can encode is
> 9007199254740991 which corresponds to Tuesday, June 5, 2255   . This
> honestly is too soon in the future for my comfort.  I suggest encoding 64
> bit integers as string literals instead to avoid the truncation problem.
> 
> [0] https://datatracker.ietf.org/doc/html/rfc7159#section-6 






More information about the systemd-devel mailing list