refactor: Use `SystemTime` for timestamps
Context
Fixes #4729
Solution
Use std::time::SystemTime for time stamps instead of std::time::Duration.
- Note that
SystemTimerequiresstd, so it will not be available inside WASM. - Alternatively
chrono::DateTimemight be used, but it will be more complex (in particular we will have to handle leap seconds), so I am not sure that it is worth it
Migration Guide (optional)
Review notes (optional)
Checklist
- [ ] I've read
CONTRIBUTING.md. - [ ] (optional) I've written unit tests for the code changes.
- [ ] All review comments have been resolved.
From SDK standpoint, it can be useful to clearly see the separation between durations and timestamps in the schema. Currently they are just *_ms: u64 fields.
From SDK standpoint, it can be useful to clearly see the separation between durations and timestamps in the schema. Currently they are just
*_ms: u64fields.
One option I see here is to create DurationMs and TimestampMs newtype wrappers for u64 and use them correspondingly
One option I see here is to create
DurationMsandTimestampMsnewtype wrappers foru64and use them correspondingly
That would be helpful.
Closed, treating the latter option in https://github.com/hyperledger-iroha/iroha/pull/5015#discussion_r1812936037 as our conclusion.