VR-Link API Documentation for HLA 1516
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
DtTimestampAdjuster Class Reference

Helper that adjusts DIS/HLA timestamps using per-simulation-address latency statistics. More...

+ Collaboration diagram for DtTimestampAdjuster:

Classes

struct  PerSimAddressStats
 Per-simulation-address latency and clock-offset statistics used internally by DtTimestampAdjuster to adjust timestamps. More...
 

Public Member Functions

 DtTimestampAdjuster ()
 
virtual ~DtTimestampAdjuster ()=default
 
virtual void clear ()
 Reset all internal state. More...
 
virtual void setEnabled (bool enabled)
 Enable or disable timestamp adjustment while preserving any accumulated latency and clock-offset statistics. More...
 
virtual bool enabled () const
 Query whether timestamp adjustment is currently enabled. More...
 
virtual void setInitialLatency (const DtSimulationAddress &simAddress, double latency)
 Provide an initial latency value L(SN,AN) for a specific simulation address before simulation begins. More...
 
virtual DtTime adjust (const DtSimulationAddress &simAddress, DtTime originalTime, DtTime receiveTime, DtTime now)
 Compute an adjusted timestamp for the given simulation address. More...
 
virtual void printStats () const
 Print a simple table of per-address latency and clock-offset statistics. More...
 
virtual bool accumulateLatencySample (const DtSimulationAddress &simAddress, DtTime originalTime, DtTime receiveTime)
 Accumulate an initial latency sample for the given simulation address. More...
 
virtual void setInitialLatencySampleThreshold (int updateThreshold)
 Set the number of initial latency samples required before the adjuster reports that its latency estimate is ready. More...
 
virtual int initialLatencySampleThreshold () const
 Get the configured number of initial latency samples required before the latency estimate is considered ready. More...
 

Private Types

typedef std::map
< DtSimulationAddress,
PerSimAddressStats > 
StatsMap
 Map of per-simulation-address statistics, keyed by DtSimulationAddress. More...
 

Private Member Functions

PerSimAddressStats & statsFor (const DtSimulationAddress &simAddress)
 

Private Attributes

StatsMap myStats
 
bool myEnabled
 
bool myExerciseStarted
 
int myLatencySampleThreshold
 

Detailed Description

Helper that adjusts DIS/HLA timestamps using per-simulation-address latency statistics.

Decoders pass network timestamp and local receive/clock times in epoch seconds along with the simulation address (site, application). The adjuster maintains lightweight running statistics in an internal map keyed by simulation address and returns an adjusted epoch timestamp suitable to hand to the state repository.

Member Typedef Documentation

Map of per-simulation-address statistics, keyed by DtSimulationAddress.

Constructor & Destructor Documentation

DtTimestampAdjuster::DtTimestampAdjuster ( )
virtual DtTimestampAdjuster::~DtTimestampAdjuster ( )
virtualdefault

Member Function Documentation

virtual bool DtTimestampAdjuster::accumulateLatencySample ( const DtSimulationAddress &  simAddress,
DtTime  originalTime,
DtTime  receiveTime 
)
virtual

Accumulate an initial latency sample for the given simulation address.

Then continues to accumulate and track latency for the duration of the simulation, but only returns true (ready) once the initial sample threshold is reached.

This is typically called by decoders when entity state data is received with a relative timestamp. The function uses the incoming message timestamp and the local receive time to estimate one sample of link latency for the specified simulation address. Samples are accumulated until initialLatencySampleThreshold() is reached, at which point the internal latency estimate is considered ready for use by adjust().

Parameters
simAddressSimulation address for per-source tracking.
originalTimeIncoming message timestamp in epoch time (seconds).
receiveTimeLocal receive time in epoch time (seconds).
Returns
True if the sample was successfully accumulated, false otherwise.
virtual DtTime DtTimestampAdjuster::adjust ( const DtSimulationAddress &  simAddress,
DtTime  originalTime,
DtTime  receiveTime,
DtTime  now 
)
virtual

Compute an adjusted timestamp for the given simulation address.

Parameters
simAddressSimulation address for per-source tracking.
originalTimeIncoming message timestamp in epoch time (seconds).
receiveTimeLocal receive time in epoch time (seconds).
nowCurrent local clock time in epoch time (seconds).
Returns
Adjusted timestamp in epoch time; if disabled, this is originalTime.
virtual void DtTimestampAdjuster::clear ( )
virtual

Reset all internal state.

virtual bool DtTimestampAdjuster::enabled ( ) const
virtual

Query whether timestamp adjustment is currently enabled.

Returns
true if adjust() applies latency/offset corrections, false if it simply returns the original timestamp.
virtual int DtTimestampAdjuster::initialLatencySampleThreshold ( ) const
virtual

Get the configured number of initial latency samples required before the latency estimate is considered ready.

virtual void DtTimestampAdjuster::printStats ( ) const
virtual

Print a simple table of per-address latency and clock-offset statistics.

virtual void DtTimestampAdjuster::setEnabled ( bool  enabled)
virtual

Enable or disable timestamp adjustment while preserving any accumulated latency and clock-offset statistics.

When disabled, adjust() returns the original (unmodified) timestamp values.

Parameters
enabledSet to true to apply adjustments, false to bypass them.
virtual void DtTimestampAdjuster::setInitialLatency ( const DtSimulationAddress &  simAddress,
double  latency 
)
virtual

Provide an initial latency value L(SN,AN) for a specific simulation address before simulation begins.

This seeds the internal statistics so that adjust() can immediately compensate for known link latency without waiting for samples to be accumulated.

Parameters
simAddressSimulation address (site, application) for which the latency value applies.
latencyOne-way link latency in the same time units as DtTime (typically seconds).
virtual void DtTimestampAdjuster::setInitialLatencySampleThreshold ( int  updateThreshold)
virtual

Set the number of initial latency samples required before the adjuster reports that its latency estimate is ready.

This threshold controls when accumulateLatencySample() begins returning a ready state.

PerSimAddressStats& DtTimestampAdjuster::statsFor ( const DtSimulationAddress &  simAddress)
private

Member Data Documentation

bool DtTimestampAdjuster::myEnabled
private
bool DtTimestampAdjuster::myExerciseStarted
private
int DtTimestampAdjuster::myLatencySampleThreshold
private
StatsMap DtTimestampAdjuster::myStats
private

The documentation for this class was generated from the following file:

Document ID: Generated on Mon Sep 28 00:09:32 EDT 2026 from SVN revision 295353
Copyright © 1992-2025 MAK Technologies. All Rights Reserved (www.mak.com)