I'm confused at what you're trying to do. Is it more than just the basic, checking system time? i.e.,



long initialTime = System.currentTimeMillis();
while (somethingIsTrue) {

...