diff --git a/src/edu/nps/moves/dis7/utilities/PduFactory.java b/src/edu/nps/moves/dis7/utilities/PduFactory.java index cc132764f8523c462dc87cec61d326c6cb4eabbf..290671b3083ee1ad1a70699a81f0f1407f84a798 100644 --- a/src/edu/nps/moves/dis7/utilities/PduFactory.java +++ b/src/edu/nps/moves/dis7/utilities/PduFactory.java @@ -39,7 +39,6 @@ public class PduFactory private byte defaultExerciseId = 1; private short defaultSiteId = 2; private short defaultAppId = 3; - private boolean useAbsoluteTimestamp = true; private final DisTime disTime; private Method getTime; @@ -128,9 +127,12 @@ public class PduFactory useFastPdu = tf; } - /* ***************************************************/ - /* utility methods*/ - private int doTime() + /** Retrieve the current timestamp in the time stamp style set at factory + * instantiation. + * @return the current timestamp in the time stamp style set at factory + * instantiation + */ + public int getTimestamp() { try { return (int) getTime.invoke(disTime, (Object[]) null); @@ -140,11 +142,13 @@ public class PduFactory } } + /* ***************************************************/ + /* utility methods*/ private PduBase addBoilerPlate(PduBase pdu) { pdu.getPduStatus().setValue((byte) (PduStatus.AII_ACTIVE | PduStatus.CEI_COUPLED)); pdu.setExerciseID(defaultExerciseId) - .setTimestamp(doTime()) + .setTimestamp(getTimestamp()) .setLength((short) pdu.getMarshalledSize()); //todo check if should be done in Pdu class return pdu; @@ -153,7 +157,7 @@ public class PduFactory private LiveEntityFamilyPdu addBoilerPlate(LiveEntityFamilyPdu pdu) { pdu.setExerciseID(defaultExerciseId) - .setTimestamp(doTime()) + .setTimestamp(getTimestamp()) .setLength((short) pdu.getMarshalledSize()); //todo check if should be done in Pdu class return pdu;