Where is the call for time() in your example?
If you want to generate new time, means current time, you need to call time() function.
for example:
String currentTime=time();
...
//some code
...
currentTime=time();//initializing current time
0
solved Return breakes loop