1 \addtogroup user-defined-watch-service
3 \brief Explains Watch concept and its usage across different corners of SDK.
5 By default, the Handler uses a precise watch returning UTC time
6 (Universal Time Coordinated). The SDK exposes the given watch
7 service as the OnixS::CME::MDH::UtcWatch class. It's used by
8 the Feed Engine to assign the receive time for incoming data and
9 to determine timeouts. File-based implementation of the Logger
10 abstraction also uses the noted watch to label logged events.
12 However, the SDK allows switching using a different watch including
13 the custom implementation providing faster or more precise timing.
14 For this reason, the SDK exposes the OnixS::CME::MDH::WatchService
15 abstract class. Users may bind its instances to the other services
16 requiring a watch like the Feed Engine or the Logger.
18 A custom watch must be derived from the OnixS::CME::MDH::WatchService
19 class. Afterwards, an instance of a derived descendant must be associated
20 with a corresponding service.
22 The following code depicts how to make the Feed Engine to timestamp packets
23 with a local time. The SDK includes ready-to-use implementation of a watch
24 returning local time. Therefore, an instance of a local watch is always
25 available for the users.
29 // Watch returning local time is always available.
30 WatchService& localWatch = LocalWatch::service();
32 FeedEngineSettings feSettings;
34 feSettings.watch(localWatch);
38 \note Feed Engine uses multiple threads as well as Logger implementations
39 may be multi-threaded. Therefore, OnixS::CME::MDH::WatchService::now can be
40 called concurrently and thus it must be thread safe.
42 \section timestamp-impl-details Timestamp
44 OnixS::CME::MDH::WatchService::now returns time as instance of OnixS::CME::MDH::Timestamp
45 class. Internally OnixS::CME::MDH::Timestamp corresponds to CME MDH timestamp representation
46 using unsigned 64-bit integer storing a number of nanoseconds since Unix Epoch
47 (01-01-1970 00:00:00 UTC). So the most effective way to pass a number of nanoseconds since
48 Epoch while constructing an instance of the class.