Create TimeUnit

Eliminate the get_time_unit() and get_unit_name() functions and replace
them with a TimeUnit class.  This also normalizes all the possible
exceptions to just ValueError, and ensures that a negative time unit
cannot be set.