Coverage Report - org.openpermis.builder.SystemClock
 
Classes in this File Line Coverage Branch Coverage Complexity
SystemClock
100%
4/4
N/A
1
 
 1  
 /*
 2  
  * Copyright (c) 2009, Swiss Federal Department of Defence Civil Protection and Sport
 3  
  *                     (http://www.vbs.admin.ch)
 4  
  * Copyright (c) 2009, Ergon Informatik AG (http://www.ergon.ch)
 5  
  * All rights reserved.
 6  
  *
 7  
  * Licensed under the Open Permis License which accompanies this distribution,
 8  
  * and is available at http://www.openpermis.org/BSDlicenceKent.txt
 9  
  */
 10  
 package org.openpermis.builder;
 11  
 
 12  
 import java.util.Calendar;
 13  
 
 14  
 import org.openpermis.basic.Clock;
 15  
 import org.openpermis.policy.TimeStamp;
 16  
 
 17  
 
 18  
 /**
 19  
  * A clock service that returns time values using the system clock.
 20  
  * @since 0.1.0
 21  
  */
 22  
 public final class SystemClock
 23  
         implements Clock
 24  
 {
 25  
 
 26  
         //---- Static
 27  
         
 28  
         /**
 29  
          * The system clock singleton.
 30  
          * @since 0.1.0
 31  
          */
 32  1
         public static final Clock INSTANCE = new SystemClock();
 33  
         
 34  
         //---- Constructors
 35  
         
 36  
         /**
 37  
          * @since 0.1.0
 38  
          */
 39  1
         private SystemClock () {
 40  
                 // Prevent public instantiation.
 41  1
         }
 42  
 
 43  
         //---- Clock
 44  
 
 45  
         /**
 46  
          * @since 0.1.0
 47  
          */
 48  
         public TimeStamp getTime () {
 49  2
                 return TimeStamp.fromCalendar(Calendar.getInstance());
 50  
         }
 51  
 
 52  
 }