Fixes for #466

Fixed the way that the times were being sorted in the histogram panel. Negative numbers were throwing it all out of whack.

Also added an interval class to handle complex interval measurements, like year and month, which aren't constant.