influxdata / influxdata/pbjson
Timestamp from chrono DateTime doesn't follow spec for pre-UNIX epoch dates
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 116
- Forks
- 55
- PR merge metrics
- No merged PRs in 30d
Description
The contract for a timestamp requires that a timestamp with a negative `seconds` component must have a negative `nanos` component. As currently implemented, the `nanos` component will _always_ be positive when converting from a chrono DateTime. This may cause issues with downstream consumers who expect that the `nanos` field will follow the behavior defined in the documentation and require a timestamp from before 1970.
For reference on how to correct this, see the implementation of `From` in `prost-types`. (It would also be nice if `pbjson-types` included a `From` implementation as well.)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the chrono DateTime conversion in pbjson-types and compare its pre-UNIX-epoch behavior with the From implementation in prost-types. Verify that negative seconds and nanos satisfy the timestamp contract, and check whether a From implementation is also in scope; done means the conversion agrees with the documented representation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100