Conversation
|
A TimePoint is the equivalent to an "Instant" in std, TimeDelta to "Duration". You can not add the TimePoints or dates "next Tuesday" and "next Friday", but you can add or subtract a TimeDelta of "3 days". "TimePoint minus TimePoint" is a TimeDelta. So "Monday + (Friday - Thursday) = Monday + 1day = Tuesday". The idea behind this separation was to forbid the addition of TimePoints to avoid implementation mistakes. It might be a little bit overengineered :) Try using a TimeDelta for your application and see how it goes. |
|
I just copied the missing Add so we have Add and Sub. Right now I'm Subtracting a negative so it's working for my use but klunky. I'm making a short preview video with the subtitles baked in to test that the subtitles are aligned correct: I'm quite new to rust so please let me know if there's a better way. |
Sub for TimePoint exists, but not Add:
However we have
impl Sub<TimeDelta> for TimePoint, so this works to add:This PR adds the Add for TimePoint, so now there is both add and sub.
The crate is awesome, thanks!