fix tests and simplify time calculations