Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TAI64 timestamps #167

Open
adlerjohn opened this issue Jun 21, 2020 · 1 comment
Open

Support TAI64 timestamps #167

adlerjohn opened this issue Jun 21, 2020 · 1 comment

Comments

@adlerjohn
Copy link

adlerjohn commented Jun 21, 2020

Currently, only TAI64N timestamps are supported, which represent time as 96 bits (64 for seconds and 32 for nanoseconds). The specs erroneously define timestamps as using the TAI64 format.

There should be support for TAI64 in addition to TAI64N. The former uses only 64 bits to represent time at a resolution of seconds, and is 33% smaller than TAI64N (in other words, TAI64N is 50% larger than TAI64). This is more than sufficient for almost all blockchains, which do not have an external clock and have blocktimes much longer than a single second.

@tony-iqlusion
Copy link
Member

tony-iqlusion commented Jun 21, 2020

The specs erroneously define timestamps as using the TAI64 format.

It goes a bit beyond that. The current Rust implementation encodes the components of a TAI timestamp using vint64. This addresses your comments about the serialized size, however it is worth noting that the actual wire format being explored right now is a TAI64N-like encoding for TAI using vint64 for on-the-wire serialization (i.e. it's not technically a 96-bit "TAI64N" timestamp).

This means that if the nanosecond component is omitted, it costs only a single additional byte over having a secondary TAI64-like format.

I strongly agree the spec should be updated to clarify all of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants