OnixS C++ CME Streamlined Market Data Handler  1.0.0.4
API documentation
User Defined Watch Service

By default, the Handler uses a precise watch returning UTC time (Universal Time Coordinated). The SDK exposes the given watch service as the OnixS::CME::Streamlined::MDH::UtcWatch class. It's used by the Feed Engine 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::Streamlined::MDH::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::Streamlined::MDH::WatchService class. Afterwards, an instance of a derived descendant must be associated with a corresponding service.

The following code depicts how to make the Feed Engine to timestamp packets with a 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();
FeedEngineSettings feSettings;
feSettings.watch(localWatch);
Note
Feed Engine uses multiple threads as well as Logger implementations may be multi-threaded. Therefore, OnixS::CME::Streamlined::MDH::WatchService::now can be called concurrently and thus it must be thread safe.

Timestamp

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