Open dukesook opened 4 months ago
Right now this library only accepts integer millisecond counts as input and throws an exception otherwise. It also returns results truncated to the millisecond. The reason for this is that this is how JavaScript time is expressed.
However, there is some semi-secret internal infrastructure which carries out all the relevant calculations using precise ratios of BigInts. We only truncate at the very end, everything internal is exact. It could be possible to expose this interface, or some kind of microsecond converter or nanosecond converter or similar.
What are your actual requirements? Or are you just curious?
MPEG is adding a TAI nanosecond timestamp capability for their HEIF & MP4 files. I'm wondering if there's any open-source tool to convert such a timestamp to/from a human readable form. However, It seems like everyone uses UTC with millisecond precision.
I would be interested in such an interface that handles an arbitrary level of precision.
I see. Well, some of the pieces for that are in place, but I wouldn't exactly call them suitable for public consumption, there's a decent amount of jank. Let me think about the best way to provide that interface.
@dukesook I should probably mention that you may be able to get away with:
const OFFSET_MILLIS = 37_000
const unixToAtomic = x => x + OFFSET_MILLIS
const atomicToUnix = x => x - OFFSET_MILLIS
Similarly for microseconds, nanoseconds or whatever. This implementation is sufficient for your needs provided that
Hello,
Does this repository support TAI timestamps with greater precision than milliseconds? Like microseconds or even nanoseconds?