1 2 40 41 package org.krysalis.jcharts.test; 42 43 44 45 public class StopWatch 46 { 47 private long start; 48 private long stop; 49 50 51 public StopWatch() 52 { 53 54 } 55 56 57 public void start() 58 { 59 this.start= System.currentTimeMillis(); 60 } 61 62 63 64 public void stop() 65 { 66 this.stop= System.currentTimeMillis(); 67 } 68 69 70 71 public String toString() 72 { 73 long difference= this.stop - this.start; 74 long seconds= ( difference / 1000 ) % 60; 75 long minutes= difference / 1000 / 60 % 60; 76 long hours= difference / 1000 / 60 / 60; 77 78 StringBuffer s= new StringBuffer ( 100 ); 79 s.append( "Total Execution Time: " + hours + "h " + minutes + "m " + seconds + "s." ); 80 return s.toString(); 81 } 82 83 84 85 } 86 | Popular Tags |