OpenDDS  Snapshot(2023/04/28-20:55)
Time_Helper.h
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.opendds.org/license.html
6  */
7 
8 #ifndef OPENDDS_DCPS_TIME_HELPER_H
9 #define OPENDDS_DCPS_TIME_HELPER_H
10 
11 #include <dds/DdsDcpsCoreC.h>
12 #include <dds/DdsDcpsInfoUtilsC.h>
13 
14 #include <ace/OS_NS_sys_time.h>
15 
16 #if !defined (ACE_LACKS_PRAGMA_ONCE)
17 #pragma once
18 #endif /* ACE_LACKS_PRAGMA_ONCE */
19 
21 
22 namespace OpenDDS {
23 namespace DCPS {
24 
27 
30 
32 MonotonicTime_t time_value_to_monotonic_time(const ACE_Time_Value& tv);
33 
36 
39  const ACE_Time_Value& now);
40 
43 
46 
47 /// Validate DDS::Duration_t value (infinite or positive and
48 /// non-zero).
50 bool valid_duration(DDS::Duration_t const & t);
51 
52 /// Check if given duration is either infinite or greater than or
53 /// equal to zero.
56 
57 #ifndef OPENDDS_SAFETY_PROFILE
59 bool operator==(const DDS::Duration_t& t1, const DDS::Duration_t& t2);
60 
62 bool operator!=(const DDS::Duration_t& t1, const DDS::Duration_t& t2);
63 #endif
64 
66 bool operator<(const DDS::Duration_t& t1, const DDS::Duration_t& t2);
67 
69 bool operator<=(const DDS::Duration_t& t1, const DDS::Duration_t& t2);
70 
72 bool operator>(const DDS::Duration_t& t1, const DDS::Duration_t& t2);
73 
75 bool operator>=(const DDS::Duration_t& t1, const DDS::Duration_t& t2);
76 
78 bool operator!(const DDS::Time_t& t);
79 
80 #ifndef OPENDDS_SAFETY_PROFILE
82 bool operator==(const DDS::Time_t& t1, const DDS::Time_t& t2);
83 
85 bool operator!=(const DDS::Time_t& t1, const DDS::Time_t& t2);
86 #endif
87 
89 bool operator<(const DDS::Time_t& t1, const DDS::Time_t& t2);
90 
92 bool operator<=(const DDS::Time_t& t1, const DDS::Time_t& t2);
93 
95 bool operator>(const DDS::Time_t& t1, const DDS::Time_t& t2);
96 
98 bool operator>=(const DDS::Time_t& t1, const DDS::Time_t& t2);
99 
101 DDS::Time_t operator+(const DDS::Time_t& t1, const DDS::Duration_t& d1);
102 
104 DDS::Duration_t operator-(const DDS::Time_t& t1, const DDS::Time_t& t2);
105 
107 DDS::Time_t operator-(const DDS::Time_t& t1, const DDS::Duration_t& t2);
108 
110 DDS::Duration_t operator-(const MonotonicTime_t& t1, const MonotonicTime_t& t2);
111 
113 bool operator<(const MonotonicTime_t& t1, const MonotonicTime_t& t2);
114 
115 #ifndef OPENDDS_SAFETY_PROFILE
117 bool operator==(const MonotonicTime_t& t1, const MonotonicTime_t& t2);
118 #endif
119 
121 ACE_UINT32 uint32_fractional_seconds_to_nanoseconds(ACE_UINT32 fraction);
122 
124 ACE_UINT32 nanoseconds_to_uint32_fractional_seconds(ACE_UINT32 fraction);
125 
127 ACE_UINT32 uint32_fractional_seconds_to_microseconds(ACE_UINT32 fraction);
128 
130 ACE_UINT32 microseconds_to_uint32_fractional_seconds(ACE_UINT32 fraction);
131 
133 bool is_infinite(const DDS::Duration_t& value);
134 
136 const MonotonicTime_t& monotonic_time_zero();
137 
139 DDS::Duration_t make_duration_t(int sec, unsigned long nanosec);
140 
142 DDS::Time_t make_time_t(int sec, unsigned long nanosec);
143 
144 } // namespace DCPS
145 } // namespace OpenDDS
146 
148 
149 #if defined(__ACE_INLINE__)
150 #include "Time_Helper.inl"
151 #endif /* __ACE_INLINE__ */
152 
153 #endif /* OPENDDS_DCPS_TIME_HELPER_H */
const LogLevel::Value value
Definition: debug.cpp:61
ACE_INLINE OpenDDS_Dcps_Export ACE_UINT32 uint32_fractional_seconds_to_microseconds(ACE_UINT32 fraction)
ACE_INLINE OpenDDS_Dcps_Export DDS::Duration_t operator-(const DDS::Time_t &t1, const DDS::Time_t &t2)
ACE_INLINE OpenDDS_Dcps_Export bool operator!(const DDS::Time_t &t)
Definition: Time_Helper.inl:77
ACE_INLINE OpenDDS_Dcps_Export DDS::Time_t time_value_to_time(const ACE_Time_Value &tv)
ACE_INLINE OpenDDS_Dcps_Export bool non_negative_duration(const DDS::Duration_t &t)
#define OpenDDS_Dcps_Export
Definition: dcps_export.h:24
ACE_INLINE OpenDDS_Dcps_Export bool operator>(const DDS::Duration_t &t1, const DDS::Duration_t &t2)
Definition: Time_Helper.inl:65
bool operator==(const DisjointSequence::OrderedRanges< T > &a, const DisjointSequence::OrderedRanges< T > &b)
ACE_INLINE OpenDDS_Dcps_Export ACE_UINT32 uint32_fractional_seconds_to_nanoseconds(ACE_UINT32 fraction)
ACE_INLINE OpenDDS_Dcps_Export bool operator<=(const DDS::Duration_t &t1, const DDS::Duration_t &t2)
Definition: Time_Helper.inl:55
ACE_INLINE OpenDDS_Dcps_Export ACE_UINT32 nanoseconds_to_uint32_fractional_seconds(ACE_UINT32 fraction)
ACE_INLINE OpenDDS_Dcps_Export bool valid_duration(DDS::Duration_t const &t)
ACE_INLINE OpenDDS_Dcps_Export DDS::Duration_t make_duration_t(int sec, unsigned long nanosec)
ACE_INLINE OpenDDS_Dcps_Export ACE_Time_Value time_to_time_value(const DDS::Time_t &t)
ACE_INLINE OpenDDS_Dcps_Export const MonotonicTime_t & monotonic_time_zero()
ACE_INLINE OpenDDS_Dcps_Export ACE_UINT32 microseconds_to_uint32_fractional_seconds(ACE_UINT32 fraction)
ACE_INLINE OpenDDS_Dcps_Export DDS::Duration_t time_value_to_duration(const ACE_Time_Value &tv)
bool operator>=(const LogLevel &ll, LogLevel::Value value)
Definition: debug.h:61
SequenceNumber operator+(const SequenceNumber &lhs, int rhs)
ACE_INLINE OpenDDS_Dcps_Export ACE_Time_Value duration_to_time_value(const DDS::Duration_t &t)
bool operator!=(const GUID_t &lhs, const GUID_t &rhs)
Definition: GuidUtils.h:125
ACE_INLINE OpenDDS_Dcps_Export DDS::Time_t make_time_t(int sec, unsigned long nanosec)
ACE_INLINE OpenDDS_Dcps_Export bool is_infinite(const DDS::Duration_t &value)
ACE_INLINE OpenDDS_Dcps_Export MonotonicTime_t time_value_to_monotonic_time(const ACE_Time_Value &tv)
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
ACE_INLINE OpenDDS_Dcps_Export DDS::Duration_t time_to_duration(const DDS::Time_t &t)
ACE_INLINE OpenDDS_Dcps_Export ACE_Time_Value duration_to_absolute_time_value(const DDS::Duration_t &t, const ACE_Time_Value &now)
#define ACE_INLINE
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
bool operator<(const GUID_t &lhs, const GUID_t &rhs)
Definition: GuidUtils.h:80