|
DUDS
|
Distributed Update of Data from Something
|
Uses the Linux specific adjtimex() function to query for the time and the quailty of the time sample. More...
#include <LinuxClock.hpp>
Classes | |
| struct | Token |
Public Types | |
| typedef duds::data::GenericMeasurement< SVT, SQT, TVT, TQT > | Measurement |
Public Types inherited from duds::hardware::devices::clocks::GenericClock< SVT, SQT, TVT, TQT > | |
| typedef std::shared_ptr< GenericClock< SVT, SQT, TVT, TQT > > | ClockSptr |
| typedef duds::data::GenericMeasurement< SVT, SQT, TVT, TQT > | Measurement |
| The measurement type provided by the instruments of this device. More... | |
Public Types inherited from duds::hardware::devices::GenericDevice< SVT, SQT, TVT, TQT > | |
| typedef clocks::GenericClock< SVT, SQT, TVT, TQT > | Clock |
| The clock driver type used by the instruments of this device for time stamps. More... | |
| typedef std::shared_ptr< Clock > | ClockSptr |
| A shared pointer type to the clock type used by this device. More... | |
| typedef std::shared_ptr< const Measurement > | ConstMeasurementSptr |
| A shared pointer type to the const measurement type used by this device. More... | |
| typedef std::shared_ptr< const Sensor > | ConstSensorSptr |
| A shared pointer type to the const sensor type used by this device. More... | |
| typedef duds::data::GenericMeasurement< SVT, SQT, TVT, TQT > | Measurement |
| The measurement type provided by the instruments of this device. More... | |
| typedef std::shared_ptr< Measurement > | MeasurementSptr |
| A shared pointer type to the measurement type used by this device. More... | |
| typedef GenericSensor< SVT, SQT, TVT, TQT > | Sensor |
| The sensor type used by this device. More... | |
| typedef std::shared_ptr< Sensor > | SensorSptr |
| A shared pointer type to the sensor type used by this device. More... | |
| typedef std::weak_ptr< Sensor > | SensorWptr |
| A weak pointer type to the sensor type used by this device. More... | |
Public Member Functions | |
| virtual void | sample () |
| Samples the time from this clock stores it in the measured field of the Measurement object of the device's first sensor. More... | |
| virtual void | sample (const ClockSptr &clock) |
| Samples the time from this clock and the given clock, then stores the measurement. More... | |
| virtual void | sampleTime (typename Measurement::TimeSample &time) |
| Samples the time from the clock device without storing the result in the clock's sensor object. More... | |
| virtual bool | unambiguous () const noexcept |
| Returns true if the clock properly reports the time during a leap second. More... | |
Public Member Functions inherited from duds::hardware::devices::clocks::GenericClock< SVT, SQT, TVT, TQT > | |
| operator ClockSptr () const | |
| Measurement::TimeSample | sampleTime () |
| Samples the time from the clock device without storing the result in the clock's sensor object. More... | |
Public Member Functions inherited from duds::hardware::devices::GenericDevice< SVT, SQT, TVT, TQT > | |
| ~GenericDevice () | |
| Modifies member Sensor objects so they no longer have a pointer back to this object, and waits for calls those objects may be making to sharedPtr() to complete. More... | |
| ConstMeasurementSptr | currentMeasurement (unsigned int sIdx=0) const |
| Returns the measurement object for the sensor at the given device specific index. More... | |
| unsigned int | numSensors () const |
| Returns the number of sensors provided by this device. More... | |
| virtual void | sample (const ClockSptr &clock)=0 |
| Samples the device and updates its sensor objects, and provides a timestamp from the given clock device. More... | |
| const SensorSptr & | sensor (unsigned int sIdx=0) const |
| Returns the sensor object at the given device specific index. More... | |
| std::shared_ptr< GenericDevice< SVT, SQT, TVT, TQT > > | sharedPtr () |
| Returns a shared pointer to this device object; will be empty if this object's destructor is running. More... | |
Public Member Functions inherited from duds::Something | |
| virtual | ~Something ()=0 |
| std::string | getName () const |
| Returns the name for the current locale. More... | |
| const general::LanguageTaggedStringMap & | names () const |
| Returns the set of names for all locales and languages. More... | |
| bool | operator!= (const Something &s) const |
| Something objects are compared using the someId member. More... | |
| bool | operator< (const Something &s) const |
| Something objects are compared using the someId member. More... | |
| bool | operator<= (const Something &s) const |
| Something objects are compared using the someId member. More... | |
| bool | operator== (const Something &s) const |
| Something objects are compared using the someId member. More... | |
| bool | operator> (const Something &s) const |
| Something objects are compared using the someId member. More... | |
| bool | operator>= (const Something &s) const |
| Something objects are compared using the someId member. More... | |
| template<class DerivedClass > | |
| std::shared_ptr< DerivedClass > | sharedPtr () const |
| Returns a shared pointer to this object for a derived class. More... | |
| const boost::uuids::uuid & | uuid () const |
| Returns the object's unique identifier. More... | |
Static Public Member Functions | |
| static std::shared_ptr< GenericLinuxClock< SVT, SQT, TVT, TQT > > | make () |
| Makes a new clock device object. More... | |
Private Member Functions | |
| GenericLinuxClock (Token) | |
| Constructs a new clock device with its UUID. More... | |
| template<class Sample > | |
| void | setSample (Sample &dest, const timex &src, const duds::data::int128_t &time) |
| Takes a partially converted time from adjtimex(), completes the conversion, and places it in the destination along with sample quality data. More... | |
Static Private Member Functions | |
| static void | doSample (timex &tx, duds::data::int128_t &time) |
| Samples the time by calling adjtimex() and computes the time in either microseconds or nanoseconds (whatever adjtimex() uses) and puts it into a single number (provided in two). More... | |
Additional Inherited Members | |
Protected Member Functions inherited from duds::hardware::devices::clocks::GenericClock< SVT, SQT, TVT, TQT > | |
| GenericClock ()=delete | |
| GenericClock (const boost::uuids::uuid &id) | |
Protected Member Functions inherited from duds::hardware::devices::GenericDevice< SVT, SQT, TVT, TQT > | |
| GenericDevice ()=default | |
| Derived classes should create Sensor objects and place them in sens either in the constructor or an initialization function. More... | |
| GenericDevice (const boost::uuids::uuid &id) | |
| Derived classes should create Sensor objects and place them in sens either in the constructor or an initialization function. More... | |
| void | setMeasurement (const ConstMeasurementSptr &store, int sIdx=0) const |
| Updates the current measurement of a member sensor. More... | |
| void | setMeasurement (ConstMeasurementSptr &&store, int sIdx=0) const |
| Updates the current measurement of a member sensor. More... | |
Protected Member Functions inherited from duds::Something | |
| Something ()=default | |
| Simple constructor. More... | |
| Something (const boost::uuids::uuid &id) | |
| Creates Something with the given UUID. More... | |
| void | setUuid (const boost::uuids::uuid &id) |
| Sets the UUID that is associated with this object. More... | |
Static Protected Member Functions inherited from duds::hardware::devices::clocks::GenericClock< SVT, SQT, TVT, TQT > | |
| template<class Ratio , class Src , class Dest > | |
| static void | convert (Dest &dest, const Src &src) |
| General template to convert time in one format to another. More... | |
| template<class Ratio , class Src > | |
| static void | convert (duds::time::interstellar::FemtoTime &dest, const Src &src) |
| Template specialization to convert time in one format to FemtoTime. More... | |
| template<class Ratio , class Src > | |
| static void | convert (duds::time::interstellar::NanoTime &dest, const Src &src) |
| Template specialization to convert time in one format to NanoTime. More... | |
| template<class Ratio , class Src > | |
| static void | convert (duds::data::GenericValue &dest, const Src &src) |
| Template specialization to convert time in one format to FemtoTime in a GenericValue. More... | |
| template<class Ratio , class IST , class Src > | |
| static void | convertIST (IST &dest, const Src &src) |
| Template to convert time in one format to one of the types defined in duds::time::interstellar. More... | |
| template<class Ratio , class IST > | |
| static void | convertIST (IST &dest, const duds::data::int128_t &src) |
| More specialized template to convert time stored in a 128-bit integer to one of the types defined in duds::time::interstellar. More... | |
Protected Attributes inherited from duds::hardware::devices::GenericDevice< SVT, SQT, TVT, TQT > | |
| std::vector< SensorSptr > | sens |
| Contains Sensor objects to represent all the kinds of data this device can collect. More... | |
Protected Attributes inherited from duds::Something | |
| general::LanguageTaggedStringMap | ltnames |
| A name for this item intended for user presentation. More... | |
Uses the Linux specific adjtimex() function to query for the time and the quailty of the time sample.
When the clock is updated and synchronized to an external source using such things as NTP, GPS, or PTP, quality information is supplied through adjtimex() without the caller needing to know the underlying source. Quailty values will be duds::data::unspecified if the clock is not synchronized, and filled with values supplied by adjtimex() otherwise.
| SVT | Sample value type |
| SQT | Sample quality type |
| TVT | Time value type |
| TQT | Time quality type |
Definition at line 52 of file LinuxClock.hpp.
| typedef duds::data::GenericMeasurement<SVT, SQT, TVT, TQT> duds::hardware::devices::clocks::GenericLinuxClock< SVT, SQT, TVT, TQT >::Measurement |
Definition at line 55 of file LinuxClock.hpp.
|
inlineprivate |
Constructs a new clock device with its UUID.
Definition at line 142 of file LinuxClock.hpp.
|
inlinestaticprivate |
Samples the time by calling adjtimex() and computes the time in either microseconds or nanoseconds (whatever adjtimex() uses) and puts it into a single number (provided in two).
| tx | The place to put the result from adjtimex(). |
| time | The value that will hold the time as a single number. |
Definition at line 107 of file LinuxClock.hpp.
Referenced by duds::hardware::devices::clocks::GenericLinuxClock< SVT, SQT, TVT, TQT >::sample(), and duds::hardware::devices::clocks::GenericLinuxClock< SVT, SQT, TVT, TQT >::sampleTime().
|
inlinestatic |
Makes a new clock device object.
Definition at line 147 of file LinuxClock.hpp.
|
inlinevirtual |
Samples the time from this clock stores it in the measured field of the Measurement object of the device's first sensor.
The timestamp field will be clear.
Implements duds::hardware::devices::clocks::GenericClock< SVT, SQT, TVT, TQT >.
Definition at line 156 of file LinuxClock.hpp.
|
inlinevirtual |
Samples the time from this clock and the given clock, then stores the measurement.
The sample from this clock will be in the measured field of the Measurement object, while the sample from the given clock will be in the timestamp field.
| clock | The clock that will be sampled for the timestamp in the resulting measurement. If it is this clock, the clock must only be sampled once and the same time must be in both the measured and timestamp fields of the Measurement object. Different types may be used to hold the time in those fields so they might not evaluate as equal. |
Implements duds::hardware::devices::clocks::GenericClock< SVT, SQT, TVT, TQT >.
Definition at line 168 of file LinuxClock.hpp.
|
inlinevirtual |
Samples the time from the clock device without storing the result in the clock's sensor object.
| time | The place to put the sampled time. |
Implements duds::hardware::devices::clocks::GenericClock< SVT, SQT, TVT, TQT >.
Definition at line 150 of file LinuxClock.hpp.
|
inlineprivate |
Takes a partially converted time from adjtimex(), completes the conversion, and places it in the destination along with sample quality data.
| Sample | A GenericSample type. |
| dest | The place to store the converted time and quailty data. |
| src | The result from calling adjtimex(). Its status flags are required here. |
| time | The time in either microseconds or nanoseconds. |
Definition at line 70 of file LinuxClock.hpp.
Referenced by duds::hardware::devices::clocks::GenericLinuxClock< SVT, SQT, TVT, TQT >::sample(), and duds::hardware::devices::clocks::GenericLinuxClock< SVT, SQT, TVT, TQT >::sampleTime().
|
inlinevirtualnoexcept |
Returns true if the clock properly reports the time during a leap second.
Should the clock replay the second 59 for the leap second, then two seconds appear the same making the time ambiguous. If the clock reports 60 for the second field during a leap second, increments normally, or otherwise makes the leap second distinct, then it is unambiguous.
Ideally, ambiguous clocks should also indicate the problem in the reported quality values. For example, if a clock replays the previous second during the leap second, the accracy value should increase by a second starting one second before the leap second and continuing until after the leap second.
Implements duds::hardware::devices::clocks::GenericClock< SVT, SQT, TVT, TQT >.
Definition at line 189 of file LinuxClock.hpp.