Duration as milliseconds

Sorry, “time values” is imprecise, I mean that it’s useful to express “negative 5 days” for arithmetical purposes, but that’s not a duration (I call it an offset, because it’s only meaningful relative to some point in time).

My point is that I’d like to keep being able to distinguish the difference between “there are 5 days between the 5th and the 10th” (duration) and “the 5th is 5 days before the 10th” (offset) in Rust.

Interestingly, I did come across a previous thread discussing signed vs. unsigned Duration in Rust, and RFC #1040, so it looks like Duration was signed at some point before 1.0 but stabilized as unsigned? The motivation given for that choice in the RFC is “unsigned types remove a number of caveats and ambiguities”, but it doesn’t detail them…

3 Likes