Open etiennestuder opened 10 years ago
Thanks for the fix @etiennestuder - but it took me a couple minutes to work out WHY it fixes the issue.
The labels are not actually used for sorting - that's the point. Because they are not used for sorting the mismatched values makes the sorted zones appear to be unsorted. Just to be clear, the zones are sorted correctly, but the offsets displayed in the labels do not match the ones used for sorting. The effect is that the zones appear to not be sorted.
In TimeZoneLabelProvider#getStyledText, the offset calculation should be like this: int offset = ((TimeZone) element).getOffset(System.currentTimeMillis());
rather than: int offset = -((TimeZone) element).getOffset(0);
since this is also how the offset is calculated in TimeZoneViewerComparator.
Without this fix, the offsets displayed in the UI are not sorted and the minus/plus prefix is reverse.
Great book, btw! :-)