Unsigned version of Duration?

From my understanding Duration is Instant_A - Instant_B. Duration is a highly mechanical, and universal. One thousand milliseconds will be one thousand milliseconds regardless if the instant used to extract it where captured on February 29th or February 28th. They can be negative if Instant_A < Instant_B.

However, what you are describing with two days is more akin to Period from JodaTime. Period is difference between instant in human described terms (e.g. days, months, years) which can vary in length depending on context. Periods are calculated by adding human time units which depend on context. If you say add two days to 2014/12/31 23:00:00 you expect to get 2015/01/02 23:00:00. This can take an arbitrary amount of mili/nano/seconds depending on whether the year is leap, how many days there are in months and other complex date malarkey.

And even in Period there is a concept of forward and backwards time. A negative two day Period means - two days ago, while positive two day Period means day after tomorrow.

  1. Use cases of negative durations are easy to guess. You want to calculate difference between dates and add that difference to some other variable even if it’s negative.
  2. You can easily allow to create some kind of abs_dur function, which will return an always positive duration.