Refactor duration to be utils.time.duration (+tests)