Use time instead of a ugly trick