Merged bug fix from Stable into Unstable

This commit is contained in:
Mark DePristo 2011-10-17 13:38:11 -04:00
commit cc76826f78
1 changed files with 3 additions and 7 deletions

View File

@ -46,7 +46,7 @@ public class SimpleTimer {
* @return the name associated with this timer
*/
@Ensures("result != null")
public String getName() {
public synchronized String getName() {
return name;
}
@ -82,14 +82,14 @@ public class SimpleTimer {
/**
* @return is this timer running?
*/
public boolean isRunning() {
public synchronized boolean isRunning() {
return running;
}
/**
* @return A convenience function to obtain the current time in milliseconds from this timer
*/
public long currentTime() {
public synchronized long currentTime() {
return System.currentTimeMillis();
}
@ -119,8 +119,4 @@ public class SimpleTimer {
public synchronized double getElapsedTime() {
return (running ? (currentTime() - startTime + elapsed) : elapsed) / 1000.0;
}
public void printElapsedTime(PrintStream out) {
out.printf("SimpleTimer %s: %.2f%n", name, getElapsedTime());
}
}