View Javadoc

1   /*
2    * Licensed under the Apache License, Version 2.0 (the "License");
3    * you may not use this file except in compliance with the License.
4    * You may obtain a copy of the License at
5    *
6    * http://www.apache.org/licenses/LICENSE-2.0
7    *
8    * Unless required by applicable law or agreed to in writing, software
9    * distributed under the License is distributed on an "AS IS" BASIS,
10   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11   * See the License for the specific language governing permissions and
12   * limitations under the License.
13   */
14  
15  package net.sourceforge.basher.internal;
16  
17  /**
18   * Defines time based operations.  Allows operations for determining run-time since initialization.
19   *
20   * @author Johan Lindquist
21   * @version 1.0
22   */
23  public interface TimeSource
24  {
25      /**
26       * Returns the elapsed time of the running system.  Measured in milliseconds.
27       *
28       * @return The elapsed time since start-up.
29       */
30      public long getElapsedTime();
31  
32      /**
33       * Returns the time the system was started.  Measured in milliseconds since Midnight 1st January 1970.
34       *
35       * @return The start time.
36       */
37      public long getStartTime();
38  
39      /**
40       * Returns the current time in the system. Measured in milliseconds since Midnight 1st January 1970.
41       *
42       * @return The current time.
43       */
44      public long getCurrentTime();
45  
46      /**
47       * Resets the internal time.
48       */
49      public void reset();
50  
51      /** Produces the current nanontime.  See {@link java.lang.System#nanoTime()} for more information 
52       *
53       * @return
54       */
55      public long getNanoTime();
56  
57  }