Skip to content

Instantly share code, notes, and snippets.

@yifanlu
Created September 5, 2011 04:14
Show Gist options
  • Save yifanlu/1194078 to your computer and use it in GitHub Desktop.
Save yifanlu/1194078 to your computer and use it in GitHub Desktop.
public class Stopwatch {
public static void main(String[] args){
long startingTime = System.currentTimeMillis();
long currentTime;
long deltaTime = 0;
long stopTime = 60 * 1000; // 60 seconds in miliseconds
while((currentTime = System.currentTimeMillis()) <= startingTime + stopTime){
deltaTime = currentTime - startingTime;
System.out.printf("%d miliseconds passed\n", deltaTime);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment