From 977aeda76bfeb6ca1f597ff0f4755666ab9fa87a Mon Sep 17 00:00:00 2001
From: brutzman <brutzman@nps.edu>
Date: Sat, 22 Jan 2022 18:01:18 -0800
Subject: [PATCH] refactored DisTime utilities package in open-dis7-java
 library

---
 examples/DisShooting/src/DisShooting/NetworkComms.java | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/examples/DisShooting/src/DisShooting/NetworkComms.java b/examples/DisShooting/src/DisShooting/NetworkComms.java
index ddc743154d..09197b72c5 100644
--- a/examples/DisShooting/src/DisShooting/NetworkComms.java
+++ b/examples/DisShooting/src/DisShooting/NetworkComms.java
@@ -1,9 +1,8 @@
 package DisShooting;
 
-import edu.nps.moves.dis7.pdus.DisTime;
 import edu.nps.moves.dis7.pdus.Pdu;
-import edu.nps.moves.dis7.utilities.*;
-
+import edu.nps.moves.dis7.utilities.DisTime;
+import edu.nps.moves.dis7.utilities.PduFactory;
 import java.io.IOException;
 import java.net.*;
 import java.nio.ByteBuffer;
@@ -27,7 +26,6 @@ public class NetworkComms implements Runnable
     private PduFactory pduFactory;
     private DatagramPacket sendPacket, receivePacket;
     private ByteBuffer buffSend, buffReceive;
-    private DisTime time;
     
     /** people we notify when we receive a PDU */
     private List<PduListener> listeners;
@@ -57,8 +55,6 @@ public class NetworkComms implements Runnable
         
         try
         {
-            time = new DisTime();
-            
             // Some fancy footwork to allow us to open a UDP socket even if
             // anther program has already opened a socket on that port. Opens
             // on the wildcard address, i.e. all configured interfaces, both 
@@ -116,7 +112,7 @@ public class NetworkComms implements Runnable
      * @param aPdu to send */
     public void sendPdu(Pdu aPdu)
     {
-        aPdu.setTimestamp(time.getDisAbsoluteTimestamp());
+        aPdu.setTimestamp(DisTime.getCurrentDisAbsoluteTimestamp());
         try {
             sendPacket.setData(aPdu.marshal());
             if (!socket.isClosed())
-- 
GitLab