package com.tsi.app.common.utils;

import java.util.concurrent.TimeUnit;

public class Elapsed {

	private long sTime = 0;

	public Elapsed() {
		reset();
	}

	private long getElapsed() {
		return System.nanoTime() - sTime;
	}
	public long nanoSeconds() {
		return getElapsed();
	}

	public long milliSeconds() {
		return TimeUnit.MILLISECONDS.convert(getElapsed(), TimeUnit.NANOSECONDS);
	}

	public long seconds() {
		return TimeUnit.SECONDS.convert(getElapsed(), TimeUnit.NANOSECONDS);
	}
	
	public void reset() {
		sTime = System.nanoTime();
	}
}
