use python libs to simplify race average

i re-invented the wheel on race average, and it kind of looked like spaghetti. this change uses python's datetime and time libraries to efficiently and simply compute the time deltas in `race_average`.

also added unit tests.