/stopwatch

Thread safe implementation of stop watch

Primary LanguageJavaMIT LicenseMIT

Stop Watch

A java library that provides thread safe implimentation of stop watch

GitHub license Build Status Maven Central

HitCount Open Source Love svg2 Maintenance

Usage of stop watch

  • Maven dependency
<dependency>
  <groupId>com.github.priytam</groupId>
  <artifactId>stopwatch</artifactId>
  <version>1.0.0</version>
</dependency>
  • Gradle dependency
compile 'com.github.priytam:stopwatch:1.0.0'
  • Example
IStopWatch stopWatch = StopWatch.create();
stopWatch.id(); // id of watch
stopWatch.start(); //Start a watch
stopWatch.elapsedMillis(); // Time elapsed till now

// Pause and Start
stopWatch.pause();
stopWatch.start();

stopWatch.restart(); // Restart a watch

stopWatch.stop(); // Stop a watch