X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Fdata%2FTimestamp.java;h=6b7f77b55d361d12de91897f8ee34983d305e9de;hp=334bf499e94729ca32d18fdccaaf41c429a5708f;hb=52bf9e8686c916be37a26a0b75340393d4478b05;hpb=ca9bdb3916f9c39adbbf95d06ac95c21dafbb4e6 diff --git a/tim/prune/data/Timestamp.java b/tim/prune/data/Timestamp.java index 334bf49..6b7f77b 100644 --- a/tim/prune/data/Timestamp.java +++ b/tim/prune/data/Timestamp.java @@ -166,6 +166,14 @@ public class Timestamp return _valid; } + /** + * @param inOther other Timestamp + * @return true if this one is after the other + */ + public boolean isAfter(Timestamp inOther) + { + return _seconds > inOther._seconds; + } /** * Calculate the difference between two Timestamps in seconds @@ -177,13 +185,22 @@ public class Timestamp return _seconds - inOther._seconds; } + /** + * Add the given number of seconds offset + * @param inOffset number of seconds to add/subtract + */ + public void addOffset(long inOffset) + { + _seconds += inOffset; + _text = null; + } /** * Add the given TimeDifference to this Timestamp * @param inOffset TimeDifference to add * @return new Timestamp object */ - public Timestamp addOffset(TimeDifference inOffset) + public Timestamp createPlusOffset(TimeDifference inOffset) { return new Timestamp((_seconds + inOffset.getTotalSeconds()) * 1000L); } @@ -194,7 +211,7 @@ public class Timestamp * @param inOffset TimeDifference to subtract * @return new Timestamp object */ - public Timestamp subtractOffset(TimeDifference inOffset) + public Timestamp createMinusOffset(TimeDifference inOffset) { return new Timestamp((_seconds - inOffset.getTotalSeconds()) * 1000L); }