11 #include "adtf_base_type_traits.h"
41 template<
typename Representation,
typename Period>
42 inline tNanoSeconds(
const std::chrono::duration<Representation, Period>& oDuration):
43 nCount(std::chrono::duration_cast<std::chrono::nanoseconds>(oDuration).count())
49 nCount += tmDuration.nCount;
55 nCount -= tmDuration.nCount;
85 return tmA.nCount < tmB.nCount;
90 return tmA.nCount > tmB.nCount;
93 inline bool operator<=(
const tNanoSeconds& tmA,
const tNanoSeconds& tmB)
95 return tmA.nCount <= tmB.nCount;
98 inline bool operator>=(
const tNanoSeconds& tmA,
const tNanoSeconds& tmB)
100 return tmA.nCount >= tmB.nCount;
103 inline bool operator==(
const tNanoSeconds& tmA,
const tNanoSeconds& tmB)
105 return tmA.nCount == tmB.nCount;
108 inline bool operator!=(
const tNanoSeconds& tmA,
const tNanoSeconds& tmB)
110 return tmA.nCount != tmB.nCount;
113 inline tNanoSeconds
operator+(
const tNanoSeconds& tmA,
const tNanoSeconds& tmB)
115 return tNanoSeconds{tmA.nCount + tmB.nCount};
118 inline tNanoSeconds
operator-(
const tNanoSeconds& tmA,
const tNanoSeconds& tmB)
120 return tNanoSeconds{tmA.nCount - tmB.nCount};
123 inline tNanoSeconds operator*(
const tNanoSeconds& tmDuration,
const int64_t& nFactor)
125 return tNanoSeconds{tmDuration.nCount * nFactor};
128 inline tNanoSeconds operator*(
const int64_t& nFactor,
const tNanoSeconds& tmDuration)
130 return tNanoSeconds{nFactor * tmDuration.nCount};
133 inline tNanoSeconds operator/(
const tNanoSeconds& tmDuration,
const int64_t& tmB)
135 return tNanoSeconds{tmDuration.nCount / tmB};
138 inline int64_t operator/(
const tNanoSeconds& tmA,
const tNanoSeconds& tmB)
140 return tmA.nCount / tmB.nCount;
149 template <
typename DestinationTimeStamp,
typename SourceTimeStamp>
152 static_assert(penguin::detail::always_false<DestinationTimeStamp>,
"unsupported duration cast");
153 return DestinationTimeStamp();
159 return tmSource.nCount / 1000;
165 return tNanoSeconds{tmSource * 1000};
183 return tmSource.count() / 1000;
188 using flash::tNanoSeconds;
Copyright © Audi Electronics Venture GmbH.
tInt64 tTimeStamp
type definition for a time value.
tBool operator<(const tErrorCode &lhs, const tErrorCode &rhs)
Less-than operator for POD error type.
tBool operator<=(const tErrorCode &lhs, const tErrorCode &rhs)
Less-than-or-equal operator for POD error type.
tBool operator>(const tErrorCode &lhs, const tErrorCode &rhs)
Greater-than operator for POD error type.
tBool operator!=(const tErrorCode &lhs, const tErrorCode &rhs)
Compare two POD error code types for inequality.
tBool operator==(const tErrorCode &lhs, const tErrorCode &rhs)
Compare two POD error code types for equality.
tBool operator>=(const tErrorCode &lhs, const tErrorCode &rhs)
Greater-than-or-equal operator for POD error type.
simple_pointer_iterator< T >::difference_type operator-(const simple_pointer_iterator< T > &r1, const simple_pointer_iterator< T > &r2)
Define arithmetic - operation between iterators.
simple_pointer_iterator< T >::difference_type operator+(const simple_pointer_iterator< T > &r1, const simple_pointer_iterator< T > &r2)
Define arithmetic + operation between iterators.
std::chrono::nanoseconds nanoseconds
Compatibility to C++11 std::chrono::nanoseconds
DestinationTimeStamp duration_cast(const SourceTimeStamp &)
Duration cast base template to converted between different time resolution.
Namespace for entire ADTF SDK.
A timestamp with nanosecond precision.