Author: antonio
Date: Sun May  1 06:19:00 2005
New Revision: 165501

URL: http://svn.apache.org/viewcvs?rev=165501&view=rev
Log:
Use StopWatch

Modified:
    cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java

Modified: cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java
URL: 
http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java?rev=165501&r1=165500&r2=165501&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java 
(original)
+++ cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java Sun May  
1 06:19:00 2005
@@ -61,6 +61,7 @@
 import org.apache.cocoon.util.IOUtils;
 import org.apache.cocoon.util.log.CocoonLogFormatter;
 import org.apache.commons.lang.SystemUtils;
+import org.apache.commons.lang.time.StopWatch;
 import org.apache.log.ContextMap;
 import org.apache.log.LogTarget;
 import org.apache.log.output.ServletOutputLogTarget;
@@ -276,8 +277,9 @@
             }
         }
 
-        // remember when we started (used for timing the processing)
-        long start = System.currentTimeMillis();
+        // used for timing the processing
+        StopWatch stopWatch = new StopWatch();
+        stopWatch.start();
 
         // add the cocoon header timestamp
         res.addHeader("X-Cocoon-Version", Constants.VERSION);
@@ -440,10 +442,10 @@
                 return;
             }
 
-            long end = System.currentTimeMillis();
+            stopWatch.stop();
             String timeString = null;
             if (getLogger().isInfoEnabled()) {
-                timeString = processTime(end - start);
+                timeString = processTime(stopWatch.getTime());
                 getLogger().info("'" + uri + "' " + timeString);
             }
 
@@ -455,7 +457,7 @@
                 }
                 if (show) {
                     if ( timeString == null ) {
-                        timeString = processTime(end - start);
+                        timeString = processTime(stopWatch.getTime());
                     }
                     boolean hide = 
this.coreUtil.getCore().getSettings().isHideShowTime();
                     if (showTime != null) {


Reply via email to