Skip to content

Nanosecond-Precision Timestamps? #8058

Answered by akhenry
WFsimon asked this question in Community Q&A
Discussion options

You must be logged in to vote

Microsecond precision is broadly doable (although untested) because µs epoch values fit within a 64 bit JavaScript Number without a loss of precision.

Here's a very basic implementation of a µs time system and formatter, that represent timestamps as ms since the JavaScript epoch, with a decimal component representing microseconds. eg. 1747774208841.123 would be formatted as 2025-05-20T20:50:08.841123Z

Be warned, this is largely untested, and while the API supports this, there may be bugs where we have made dumb assumptions in the code. If so, please let us know so we can fix them!

/*
 * Define a new time system that supports µs precision timestamps.
 */
openmct.install((openmct) => {
  op…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@WFsimon
Comment options

Answer selected by WFsimon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants