/home/wpollock1/public_html/AJava/TimerRes.java
// This program attempts to measure the system clock resolution.
// On my Windows 10 PC (in 5/2021), I see 200-210 updates per second.
//
// Writeen 5/2021 by Wayne Pollock, Tampa Florida USA
public class TimerRes {
public static void main (String[] args) {
System.out.println( "Starting 60 second measurement..." );
long now = System.currentTimeMillis();
long end = now + 60 * 1_000; // One minute later
long previous = now;
int numOfTimeChanges = 0;
while ( now <= end ) {
if ( now != previous ) {
++numOfTimeChanges;
previous = now;
}
now = System.currentTimeMillis();
}
System.out.printf( "Number of Times the clock updates per "
+ "second is %.2f%n", (numOfTimeChanges/60.0) );
}
}