Variable Resolution Stopwatch
License: LGPL (license.txt)
Docs: Can be found here
Can be found here
The Deimos Timer allows seamless useage of the
millisecond timer or nanosecond timer, depending on what's available.
I needed a timer of some kind for The Deimos
Project. I wasn't happy with the results of using the millsecond
timer built into the java.lang.System class, but I wasn't happy with
the idea of being forced to use Java 1.5, either. This library is
the compromise. It allows you to use the same API to access time
data from either, or the platform specific sun.misc.Perf class.
more information, look at the API docs for StopWatch.
Here's the order of time source priority:
java.lang.System.nanoTime(), sun.misc.Perf, and
finally, java.lang.System.currentTimeMillis() if none of the others can
You also have the ability to plug in your own custom
TimeSource to StopWatch.
If you need to manually control the progression of
time in your application, try SteppingTimeSource.
While the timer is intended to be used as a library,
it is also an application that will determine the granularity of your
system's best available timer and display it for you. This will
tell you how small of an increment of time the StopWatch can provide
average). It will also test the timer library.
If you want to run the granularity test, just type
the following in a console window: "java -jar timer.jar". This can take a LONG time
for a system that can only use the millisecond system timer.
Hosting for this project generously