Moved time evaluation inside the while loop in readData()