mpd-tools
mpd-tools copied to clipboard
Replace P100Y with an hour equivalent.
In generating #10 I discovered that six of the unit tests did not pass. This was an odd failure. With some extra debugging I traced the failure to be checked at MyDifferenceEvaluator
; where it is converting both sides of the test comparison to milliseconds.
With some extra logging I get:
Durations were different: P100Y -> 3155763600000 / PT876600H -> 3155760000000
It has converted P100Y
to 3155763600000
.
3,155,763,600
seconds;
52,596,060
minutes;
876,601
hours.
876,600
looks like 100 years in hours; there are 24 leap years in the next 100 years. (there were 25 leap years in the last 100 years)
So where is that extra hour from? There would be the same number of daylight saving days in either case.
Given this comparison is using the javax.xml.datatype.DatatypeFactory
to do the conversion, it feels like the issue is there.
Regardless of the cause if the descrepency this PR allows the tests to pass.