public long getTotalElapsedTime() {
        long elapsed;
        if (running) {
             elapsed = (System.currentTimeMillis() - startTime);
             elapsed +=totalTime;
        }
        else {
            elapsed = totalTime;
        }
        return elapsed;
    }