View Javadoc

1   /*
2    *  File: TimeMachineSingleton.java 
3    *  Copyright (c) 2004-2007  Peter Kliem (Peter.Kliem@jaret.de)
4    *  A commercial license is available, see http://www.jaret.de.
5    *
6    * All rights reserved. This program and the accompanying materials
7    * are made available under the terms of the Common Public License v1.0
8    * which accompanies this distribution, and is available at
9    * http://www.eclipse.org/legal/cpl-v10.html
10   */
11  package de.jaret.util.date.timemachine;
12  
13  /**
14   * Singleton to provide a time machine. The time machine will be setup to begin with the current time. 
15   * Do your setup early in your application setup if you want a special starting time or a real time provider.
16   * 
17   * @author kliem
18   * @version $Id: TimeMachineSingleton.java 702 2007-12-30 11:54:55Z kliem $
19   */
20  public class TimeMachineSingleton {
21      /** the time machine instance. */
22      private static TimeMachine _instance = new TimeMachine(System.currentTimeMillis());
23      
24      
25      /**
26       * Retrieve the time provider instance.
27       * @return time provider to be used
28       */
29      public static ITimeProvider getTimeProvider() {
30          return _instance;
31      }
32      
33      /**
34       * Retrieve the time machine for configuration etc.
35       * @return the time machien instance
36       */
37      public static TimeMachine getTimeMachine() {
38          return _instance;
39      }
40      
41      
42  }