prost icon indicating copy to clipboard operation
prost copied to clipboard

PartialOrd and Ord for Timestamp

Open bjchambers opened this issue 3 years ago • 2 comments

It seems like Timestamp could (and perhaps should) implement PartialOrd and Ord. This should be pretty straightforward given the constraints -- compare the seconds, and if equal compare the nanos. Any reason these shouldn't be added?

(Originally filed https://github.com/fdeantoni/prost-wkt/issues/15)

bjchambers avatar Dec 02 '22 17:12 bjchambers

It would be good to look at what other protobuf impls do in this case before we move forward with this change.

LucioFranco avatar Dec 13 '22 17:12 LucioFranco

I'm also interested in having these trait implemented for Timestamp.

It would be good to look at what other protobuf impls do in this case before we move forward with this change.

Is there anythings specific you want to know? I think the implementation here is very straightforward. These traits can even be derive for Timestamp (and also Duration).

avsaase avatar Apr 02 '25 09:04 avsaase