Closed hp8wvvvgnj6asjm7 closed 1 year ago
Multiply it by 1000 or 1,000,000 and use unix_timestamp_nanos
. The only reason there are even two methods is because they accept different types.
https://doc.rust-lang.org/nightly/core/time/struct.Duration.html#implementations
https://github.com/rust-lang/rust/issues/57391
why would you not add this for the same ergonomic reasons?
I'm not sure I follow. A Duration
and an OffsetDateTime
are two completely different types with zero overlap in functionality.
On this note, I think it is important to explicitly state, in the docs, that the *_unix_timestamp()
functions operate on seconds, as opposed to some other unit, such as milliseconds. I know it should be understood or expected that all Unix timestamps are in second, but this omission could potentially lead to confusion and ambiguity, since some external APIs, such as Javascript's Date API (in the context of a WASM module), returns millisecond timestamps.
@AshfordN The Unix timestamp is, by definition, in seconds.
Am I missing something here?