Windows: do not call time() in a loop