Skip to content
Snippets Groups Projects
Commit 977aeda7 authored by Brutzman, Don's avatar Brutzman, Don
Browse files

refactored DisTime utilities package in open-dis7-java library

parent 53be76d0
No related branches found
No related tags found
No related merge requests found
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())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment