package helpers;

public class Chrono {

    private static long startTime;
    private static long startPause;
    private static long totalPause;

    public Chrono() {
        reinitialization();
    }

    public void reinitialization() {
        startTime  = 0;
        startPause = 0;
        totalPause = 0;
    }

    public void start() {
        reinitialization();
        startTime = System.currentTimeMillis();
    }

    public void resume() {
        if (startTime == 0 || startPause == 0) {
            /* Has not be started */
            return;
        }

        totalPause += System.currentTimeMillis() - startPause;
    }

    public void pause() {
        if (startTime == 0) {
            /* Has not be started */
            return;
        }

        startPause = System.currentTimeMillis();
    }

    public void stop() {
        reinitialization();
    }

    public long timeEllapsed() {
        return System.currentTimeMillis() - startTime - totalPause;
    }

    @Override
    public String toString() {
        long realTime = timeEllapsed();

        int minutes      = (int) ((realTime / 1000) / 60);
        int seconds      = (int) ((realTime / 1000) % 60);
        int milliseconds = (int) ((realTime / 100)  % 10);

        return String.format("%02d:%02d:%d", minutes, seconds, milliseconds);
    }

}

@@ -1215,33 +1215,32 @@
 seconds = (int) 
-(
 (realTime / 100)
@@ -1237,19 +1237,13 @@
 ime 
-/
+%25
  100
-)  %25 1
 0);%0A
@@ -1284,16 +1284,18 @@
 d:%2502d:%25
+03
 d%22, minu

now the string is returns as XX:XX:XXX