Stopwatch.java
Go to the documentation of this file.
00001 package edu.tum.cs.ias.knowrob.util;
00002 
00009 public class Stopwatch {
00010     
00014     private long startTime = 0;
00018     private long stopTime = 0;
00022     private long elapsed = 0;
00026     private boolean running = false;
00027     
00031     public void start() {        
00032         this.running = true;
00033         this.startTime = System.currentTimeMillis();
00034     }
00035     
00039     public void stop() {
00040         this.stopTime = System.currentTimeMillis();
00041         this.running = false;
00042         elapsed += stopTime - startTime;
00043     }
00044     
00049     public long getElapsedTime() {
00050         if(running)
00051                 return elapsed + System.currentTimeMillis() - startTime;
00052         else
00053             return elapsed;
00054     }    
00055     
00060     public double getElapsedTimeSecs() {
00061         return (double)getElapsedTime() / 1000;
00062     }
00063 }


mod_vis
Author(s): Moritz Tenorth, Jakob Engel
autogenerated on Sat Dec 28 2013 17:09:49