/*
 * Timestamp.java
 * 
 * Copyright (C) 2011 IBR, TU Braunschweig
 *
 * Written-by: Johannes Morgenroth <morgenroth@ibr.cs.tu-bs.de>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package de.tubs.ibr.dtn.api;

import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;

public class Timestamp implements Comparable<Timestamp> {
	
	public final static Long TIMEVAL_CONVERSION = 946684800L;
	
	private Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
	
	public Timestamp(Date d)
	{
		calendar.setTime(d);
	}
	
	public Timestamp(Long dtntimestamp)
	{
		Long utc_timestamp = (dtntimestamp + Timestamp.TIMEVAL_CONVERSION) * 1000;
		calendar.setTimeInMillis(utc_timestamp);
	}
	
	public Date getDate()
	{
		return calendar.getTime();
	}
	
	public Long getValue()
	{
		return (getDate().getTime() / 1000) - Timestamp.TIMEVAL_CONVERSION;
	}

	@Override
	public boolean equals(Object o) {
		if (o instanceof Timestamp) {
			if (calendar != null) {
				return calendar.equals(((Timestamp)o).calendar);
			}
		}
		return super.equals(o);
	}

	@Override
	public int compareTo(Timestamp another) {
		return calendar.compareTo(another.calendar);
	}
}

@@ -1381,24 +1381,128 @@
 NVERSION;%0A%09%7D
+%0A%09%0A%09public boolean isValid() %7B%0A%09%09return getDate().getTime() %3E (Timestamp.TIMEVAL_CONVERSION * 1000L);%0A%09%7D
 %0A%0A%09@Override

Add isValid() method to Timestamp class