// The body of the thread
while(keepRunning) { // This thread runs until asked to stop
long now = System.currentTimeMillis(); // Get current time
System.out.printf("%tr%n", now); // Print it out
try { Thread.sleep(1000); } // Wait 1000 milliseconds
catch (InterruptedException e) { return; }// Quit on interrupt
}