timer.java

来自「webwork source」· Java 代码 · 共 40 行

JAVA
40
字号
/* * WebWork, Web Application Framework * * Distributable under Apache license. * See terms of license at opensource.org */package webwork.util;/** *	A bean that can be used to time execution of pages *       *	@author Rickard 謆erg (rickard@middleware-company.com) *	@version $Revision: 1.6 $ */public class Timer{   // Attributes ----------------------------------------------------   long current = System.currentTimeMillis();   long start = current;      // Public --------------------------------------------------------      public long getTime()   {      // Return how long time has passed since last check point      long now = System.currentTimeMillis();      long time = now - current;            // Reset so that next time we get from this point      current = now;      return time;   }   public long getTotal()   {      // Reset start so that next time we get from this point      return System.currentTimeMillis() - start;   }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?