Dates: TAI64, TAI or UTC?
arnsholt opened this issue · 2 comments
I've been playing around with the Biscuit format (I've always had a soft spot for Prolog, so datalog is a sure way to sell it to me), and I have a question regarding the encoding of the date type: The specification document says "A date is a 64 bit unsigned integer representing a TAI64.", which although no reference is given I assume must be DJB's scheme here. But when I look at the playground the values for now-ish dates are in the sub 2**62 range which should be pre-1970 dates unless I'm misreading the DJB document, and the values are a good match for a normal UNIX timestamp. Next, when I look at the reference Rust code, I think it uses functions that return UTC seconds since 1970, which is almost but not quite the same as TAI due to the presence of leap seconds.
So I'm wondering: am I misreading the TAI64 scheme, is the spec wording a bit unclear and the encoding is TAI seconds since the datum, or are dates encoded as UTC seconds since the datum?
right, I think what happened here is that I intended to use TAI64 (I recall some discussions around it early in spec development), but for all implementations we went with Unix timestamps. I just checked, and Rust, Java, Go and Haskell all use it, so we should update the spec to indicate a Unix timestamp
Yeah, that happens. But if it's a timestamp maybe the proto schema type should also change to an int64 rather than a uint? I mean, not being able to represent dates prior to 1970 is probably fine practically, given the typical uses of a biscuit, but it still feels incomplete. And given a signed 64 bit signed int and second resolution, the furthest date into the future that can be represented is still almost 300 billion years ahead, which really should be enough for everyone.