A new version of the Time2 Library is available at http://time2.sourceforge.net/ and http://agent.ch/timeseries/t2/.
This release brings improved time comparisons. Previously it was not possible to compare times from different domains. Now, when domain differs, times are converted automatically.
When resolutions differ, the time with the lowest resolution is converted to the one with the highest resolution. For example comparing a Day to a Year will compare the day to the implicit default day of the year (which is January 1).
When resolutions do not differ, the times are converted to the unrestricted time domain for their resolution. For example a Workday and a ThirdFriday are both converted to a Day before comparing.
These semantics are not meaningful for all possible time domains. Users of "exotic" time domains should consider writing a subclass of Time2 and override the compareTo method.
No comments:
Post a Comment