Is there a standard for inclusive/exclusive ends of time intervals?

后端 未结 6 1918
说谎
说谎 2020-12-22 23:39

I\'m wondering if there is a standard or \"normal\" means of interpreting time interval data end points with respect to inclusiveness/exclusiveness of the value def

6条回答
  •  [愿得一人]
    2020-12-23 00:08

    I'll provide what I wrote for our team as an answer using Voo's link until such time as Voo adds an answer, then I'll give him credit instead. Here's what I decided for our case:

    Time intervals in our applications will be represented as a pair of instantaneous times with the convention that the start time is inclusive and the end time is exclusive. This convention is mathematically convenient in that the difference of the bounds is equal to the length of the interval, and is also numerically consistent with the way arrays and lists are subscripted in java programs (see http://www.cs.utexas.edu/~EWD/ewd08xx/EWD831.PDF). The practical upshot of this is that interval 2012-03-17T00:00:00.000Z – 2012-03-18T00:00:00.000Z denotes the entirety of St. Patrick’s Day, and every date beginning with 2012-03-17 will be identified as included in St Patrick’s Day, but 2012-03-18T00:00:00.000Z will not be included, and St Patrick’s Day will include exactly 24*60*60*1000 milliseconds.

提交回复
热议问题