OnixS C++ CME MDP Conflated UDP Handler  1.1.2
API documentation
User Defined Watch Service

By default, the Handler uses a precise watch returning UTC (Universal Time Coordinated) time. The SDK exposes the given watch service as the OnixS::CME::ConflatedUDP::UtcWatch class. It's used by the default implementation of the Feed Engine concept to assign the receive time for incoming data and to determine timeouts. File-based implementation of the Logger abstraction also uses the noted watch to label logged events.

However, the SDK allows switching using a different watch including the custom implementation providing faster or more precise timing. For this reason, the SDK exposes the OnixS::CME::ConflatedUDP::WatchService abstract class. Users may bind its instances to the other services requiring a watch like the Feed Engine or the Logger.

A custom watch must be derived from the OnixS::CME::ConflatedUDP::WatchService class. Afterwards, an instance of a derived descendant must be associated with a corresponding service.

The following code depicts how to make the OnixS::CME::ConflatedUDP::MultithreadedFeedEngine to timestamp packets in local time. The SDK includes ready-to-use implementation of a watch returning local time. Therefore, an instance of a local watch is always available for the users.

// Watch returning local time is always available.
WatchService& localWatch = LocalWatch::service();
MultithreadedFeedEngineSettings mtfeSettings;
mtfeSettings.watch(localWatch);
Note
The OnixS::CME::ConflatedUDP::MultithreadedFeedEngine uses multiple threads as well as Logger implementations may be multi-threaded. Therefore, OnixS::CME::ConflatedUDP::WatchService::now can be called concurrently and thus it must be thread safe.

The Timestamp Internals

OnixS::CME::ConflatedUDP::WatchService::now returns time as an instance of the OnixS::CME::ConflatedUDP::Timestamp class. Internally the OnixS::CME::ConflatedUDP::Timestamp corresponds to CME MDH timestamp representation using unsigned 64-bit integer storing a number of nanoseconds since the Unix Epoch (01-01-1970 00:00:00 UTC). Thus, the most effective way to construct an instance of the class is to pass a number of nanoseconds since the Epoch.