Avoid repeated calls to time()