CCNTime extends Timestamp implements ContentName.ComponentProvider { @Override public int compareTo(Date o) { return super.compareTo(new CCNTime(o)); } CCNTime(long msec);  CCNTime(Timestamp timestamp);  CCNTime(Date time);  CCNTime(byte [] binaryTime12);  CCNTime(); protected  CCNTime(long msec, long nanos); protected  CCNTime(long binaryTimeAsLong, boolean unused); static CCNTime fromBinaryTimeAsLong(long binaryTimeAsLong); byte [] toBinaryTime(); long toBinaryTimeAsLong(); static long toBinaryTimeAsLong(long msec, long nanos); @Override void setTime(long msec); @Override void setNanos(int nanos); void addNanos(int nanos); void increment(int timeUnits); @Override boolean equals(Timestamp ts); @Override int compareTo(Date o); @Override int compareTo(Timestamp ts); @Override boolean before(Timestamp ts); @Override boolean after(Timestamp ts); @Override boolean before(Date when); @Override boolean after(Date when); static CCNTime now(); String toShortString(); final byte[] getComponent(); static final int NANOS_MAX; }
@Test public void testCompareToDate() { Log.info(Log.FAC_TEST, "Starting testCompareToDate"); CCNTime ce = new CCNTime(dearly); CCNTime cm = new CCNTime(dmiddle); CCNTime cl = new CCNTime(dlate); Assert.assertTrue(ce.compareTo(dmiddle) < 0); Assert.assertTrue(ce.compareTo(dlate) < 0); Assert.assertTrue(cm.compareTo(dearly) > 0); Assert.assertTrue(cm.compareTo(dlate) < 0); Assert.assertTrue(cl.compareTo(dearly) > 0); Assert.assertTrue(cl.compareTo(dmiddle) > 0); Log.info(Log.FAC_TEST, "Completed testCompareToDate"); }
@Test public void testCompareToTimestamp() { Log.info(Log.FAC_TEST, "Starting testCompareToTimestamp"); CCNTime ce = new CCNTime(early); CCNTime cm = new CCNTime(middle); CCNTime cl = new CCNTime(late); Assert.assertTrue(ce.compareTo(middle) < 0); Assert.assertTrue(ce.compareTo(late) < 0); Assert.assertTrue(cm.compareTo(early) > 0); Assert.assertTrue(cm.compareTo(late) < 0); Assert.assertTrue(cl.compareTo(early) > 0); Assert.assertTrue(cl.compareTo(middle) > 0); Assert.assertTrue(early.compareTo(cm) < 0); Assert.assertTrue(early.compareTo(cl) < 0); Assert.assertTrue(middle.compareTo(ce) > 0); Assert.assertTrue(middle.compareTo(cl) < 0); Assert.assertTrue(late.compareTo(ce) > 0); Assert.assertTrue(late.compareTo(cm) > 0); Log.info(Log.FAC_TEST, "Completed testCompareToTimestamp"); }