package ipipan.poliqarp.stat;

public class TimeWatch {

   long time;
   long stime;

   public TimeWatch() {
      stime = time = System.currentTimeMillis();
   }

   public void reset() {
      stime = time = System.currentTimeMillis();
   }

   public void seset() {
      time = System.currentTimeMillis();
   }

   public long getInterval() {
      long ntime = System.currentTimeMillis();
      long itime = ntime - time;
      time = ntime;
      return itime;
   }

   public void display(String desc) {
      long ntime = System.currentTimeMillis();
      System.err.println(desc+(ntime-time) + " ("+(ntime-stime)+") ms");
      time = ntime;
   }
}
