reduce the number of calls to the time function