Skip to content

Timestamp from chrono DateTime doesn't follow spec for pre-UNIX epoch dates #95

Description

@neoeinstein

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<SystemTime> in prost-types. (It would also be nice if pbjson-types included a From<SystemTime> implementation as well.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions