You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by er...@apache.org on 2005/05/20 07:00:51 UTC

svn commit: r171053 - /directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/messages/value/KerberosTime.java

Author: erodriguez
Date: Thu May 19 22:00:50 2005
New Revision: 171053

URL: http://svn.apache.org/viewcvs?rev=171053&view=rev
Log:
Formatting and imports.

Modified:
    directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/messages/value/KerberosTime.java

Modified: directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/messages/value/KerberosTime.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/messages/value/KerberosTime.java?rev=171053&r1=171052&r2=171053&view=diff
==============================================================================
--- directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/messages/value/KerberosTime.java (original)
+++ directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/messages/value/KerberosTime.java Thu May 19 22:00:50 2005
@@ -14,81 +14,98 @@
  *   limitations under the License.
  *
  */
+
 package org.apache.kerberos.messages.value;
 
-import java.util.*;
+import java.util.Date;
 
 /**
  * Implementation of the time object for Kerberos
  */
-public class KerberosTime implements Comparable {
-	
-	public static final KerberosTime INFINITY = new KerberosTime(Long.MAX_VALUE);
-	
-	private long _localTime;
-
-	public KerberosTime() {
-		_localTime = System.currentTimeMillis();
-	}
-
-	public KerberosTime(long time) {
-		_localTime = time;
-	}
-
-	public KerberosTime(Date time) {
-		_localTime = time.getTime();
-	}
-
-	public int compareTo(Object o) {
-		final int BEFORE = -1;
-		final int EQUAL  = 0;
-		final int AFTER  = 1;
-
-		// this optimization is usually worthwhile, and can always be added
-		if (this == o)
-			return EQUAL;
-
-		// Performing explicit checks for nullity and type are made redundant by
-		// the following cast, which will throw NullPointerException and
-		// ClassCastException in these respective cases.
-		final KerberosTime that = (KerberosTime) o;
-
-		// primitive numbers follow this form
-		if (this._localTime < that._localTime)
-			return BEFORE;
-		if (this._localTime > that._localTime)
-			return AFTER;
-		
-		return EQUAL;
-	}
-
-	public long getTime() {
-		return _localTime;
-	}
-
-	public Date toDate() {
-		return new Date(_localTime);
-	}
-
-	public boolean isInClockSkew(long clockSkew) {
-		KerberosTime now = new KerberosTime();
-		return Math.abs(_localTime - now._localTime) < clockSkew;
-	}
-
-	public boolean greaterThan(KerberosTime time) {
-		return _localTime > time._localTime;
-	}
-	
-	public boolean lessThan(KerberosTime time) {
-		return _localTime < time._localTime;
-	}
-
-	public boolean equals(KerberosTime time) {
-		return _localTime == time._localTime;
-	}
-
-	public boolean isZero() {
-		return _localTime == 0;
-	}
+public class KerberosTime implements Comparable
+{
+    public static final KerberosTime INFINITY = new KerberosTime(Long.MAX_VALUE);
+
+    private long localTime;
+
+    public KerberosTime()
+    {
+        localTime = System.currentTimeMillis();
+    }
+
+    public KerberosTime(long time)
+    {
+        localTime = time;
+    }
+
+    public KerberosTime(Date time)
+    {
+        localTime = time.getTime();
+    }
+
+    public int compareTo(Object o)
+    {
+        final int BEFORE = -1;
+        final int EQUAL = 0;
+        final int AFTER = 1;
+
+        // this optimization is usually worthwhile, and can always be added
+        if (this == o)
+        {
+            return EQUAL;
+        }
+
+        // Performing explicit checks for nullity and type are made redundant by
+        // the following cast, which will throw NullPointerException and
+        // ClassCastException in these respective cases.
+        final KerberosTime that = (KerberosTime) o;
+
+        // primitive numbers follow this form
+        if (this.localTime < that.localTime)
+        {
+            return BEFORE;
+        }
+        
+        if (this.localTime > that.localTime)
+        {
+            return AFTER;
+        }
+
+        return EQUAL;
+    }
+
+    public long getTime()
+    {
+        return localTime;
+    }
+
+    public Date toDate()
+    {
+        return new Date(localTime);
+    }
+
+    public boolean isInClockSkew(long clockSkew)
+    {
+        return Math.abs(localTime - System.currentTimeMillis()) < clockSkew;
+    }
+
+    public boolean greaterThan(KerberosTime time)
+    {
+        return localTime > time.localTime;
+    }
+
+    public boolean lessThan(KerberosTime time)
+    {
+        return localTime < time.localTime;
+    }
+
+    public boolean equals(KerberosTime time)
+    {
+        return localTime == time.localTime;
+    }
+
+    public boolean isZero()
+    {
+        return localTime == 0;
+    }
 }
-