3 ms·
Easier solution which increases your chance of being compatible with the rest of the world: Just use the ECMAScript Language Specification's Time-related Const
by nyrikki 3y ago
Easier solution which increases your chance of being compatible with the rest of the world:
Just use the ECMAScript Language Specification's Time-related Constants algorithms like SecFromTime (t)
https://tc39.es/ecma262/#sec-time-related-constants https://tc39.es/ecma262/#sec-time-related-constants
Even the draft of w3c's High Resolution Time just incorporate them.
https://www.w3.org/TR https://www.w3.org/TR
The ECMAScript Language Specification algorithms will help with rounding
SI allows for Quotients of SI units using either a solidus (/) or a negative exponent.
Herz is just the reciprocal of the second, 1/s or s^-1
Just as meters per second == m/s == m*s^−1
1 Hz == ∆_Cs/9,192,631,770
1 Sec == 9,192,631,770/∆_Cs
As Hertz is just a special name for s^-1 or 1/s, one can simply use the common prefixes and be mostly in sync with common standards from place like the w3c or their incorporated sources is far better than using SI for SI's sake.
Most languages have those typedefs for their duration classes/methods/functions anyway. But the ECMAScript spec above allows you to implement one that will be inter-compatible without trying to invent new or use obscure units.