CANpie FD
CAN programming interface environment - Version 3.08
|
The QCanTimeStamp class provides the functionality for setting a time-stamp with a 1 ns (nano-seconds) resolution to a CAN frame (refer to QCanFrame::setTimeStamp). The time-stamp has two data fields:
The time-stamp covers a time-period of more than 49652 days (136 years). The value of a time-stamp can be set from a counter value by means of the functions fromMicroSeconds() or fromMilliSeconds().
Public Member Functions | |
QCanTimeStamp (uint32_t ulSecondsV=0, uint32_t ulNanoSecondsV=0) | |
void | clear (void) |
void | fromMicroSeconds (uint32_t ulMicroSecondsV) |
void | fromMilliSeconds (uint32_t ulMilliSecondsV) |
bool | isValid (void) |
uint32_t | nanoSeconds (void) const |
uint32_t | seconds (void) const |
void | setNanoSeconds (uint32_t ulNanoSecondsV) |
void | setSeconds (const uint32_t ulSecondsV) |
QByteArray | toByteArray (void) const |
bool | operator== (const QCanTimeStamp &clTimeStampR) const |
bool | operator!= (const QCanTimeStamp &clTimeStampR) const |
bool | operator< (const QCanTimeStamp &clTimeStampR) const |
bool | operator<= (const QCanTimeStamp &clTimeStampR) const |
bool | operator> (const QCanTimeStamp &clTimeStampR) const |
bool | operator>= (const QCanTimeStamp &clTimeStampR) const |
QCanTimeStamp | operator+ (const QCanTimeStamp &clTimeStampR) const |
QCanTimeStamp & | operator+= (const QCanTimeStamp &clTimeStampR) |
QCanTimeStamp | operator- (const QCanTimeStamp &clTimeStampR) const |
QCanTimeStamp & | operator-= (const QCanTimeStamp &clTimeStampR) |
Static Public Member Functions | |
static QCanTimeStamp | now (void) |
QCanTimeStamp::QCanTimeStamp | ( | uint32_t | ulSecondsV = 0 , |
uint32_t | ulNanoSecondsV = 0 |
||
) |
[in] | ulSecondsV | - Set the seconds field |
[in] | ulNanoSecondsV | - Set the nano-seconds field |
Construct a time-stamp with ulSecondsV and ulNanoSecondsV. If the valid value range for the parameters is violated the object will be constructed using maximum allowed values.
void QCanTimeStamp::clear | ( | void | ) |
Clear time-stamp by setting both data fields to 0.
void QCanTimeStamp::fromMicroSeconds | ( | uint32_t | ulMicroSecondsV | ) |
[in] | ulMicroSecondsV | - time-value in microseconds [µs] |
Set the time-stamp value according to the parameter ulMicroSecondsV.
void QCanTimeStamp::fromMilliSeconds | ( | uint32_t | ulMilliSecondsV | ) |
[in] | ulMilliSecondsV | - time-value in milliseconds [msec] |
Set the time-stamp value according to the parameter ulMilliSecondsV.
bool QCanTimeStamp::isValid | ( | void | ) |
true
if time-stamp value is validReturns true
if this time-stamp is within the valid value range. The limit for the data fields are defined by TIME_STAMP_SECS_LIMIT and TIME_STAMP_NSEC_LIMIT.
|
inline |
Returns the nanoseconds part of this time-stamp. A return value of TIME_STAMP_INVALID_VALUE marks the time-stamp value as invalid. The validity of a time-stamp can be tested with isValid().
|
static |
Return a QCanTimeStamp object set to the current time point based on the High resolution clock. The method uses the high_resolution_clock::now()
function of the std::chrono
library.
bool QCanTimeStamp::operator!= | ( | const QCanTimeStamp & | clTimeStampR | ) | const |
clTimeStampR | - Reference to other time-stamp |
true
on not equal time-stampsReturns true
if this time-stamp is not equal to time-stamp clTimeStampR, otherwise returns false
.
QCanTimeStamp QCanTimeStamp::operator+ | ( | const QCanTimeStamp & | clTimeStampR | ) | const |
clTimeStampR | - Reference to other time-stamp |
Add the time-stamp clTimeStampR to this time-stamp value and returns a reference to this time-stamp.
QCanTimeStamp& QCanTimeStamp::operator+= | ( | const QCanTimeStamp & | clTimeStampR | ) |
clTimeStampR | - Reference to other time-stamp |
Add the time-stamp clTimeStampR to this time-stamp value and returns a reference to this time-stamp.
QCanTimeStamp QCanTimeStamp::operator- | ( | const QCanTimeStamp & | clTimeStampR | ) | const |
clTimeStampR | - Reference to other time-stamp |
Subtract the time-stamp clTimeStampR from this time-stamp value and returns a reference to this time-stamp.
QCanTimeStamp& QCanTimeStamp::operator-= | ( | const QCanTimeStamp & | clTimeStampR | ) |
clTimeStampR | - Reference to other time-stamp |
Subtract the time-stamp clTimeStampR from this time-stamp value and returns a reference to this time-stamp.
bool QCanTimeStamp::operator< | ( | const QCanTimeStamp & | clTimeStampR | ) | const |
clTimeStampR | - Reference to other time-stamp |
true
on smaller time-stampReturns true if this time-stamp is less than time-stamp clTimeStampR, otherwise returns false
.
bool QCanTimeStamp::operator<= | ( | const QCanTimeStamp & | clTimeStampR | ) | const |
clTimeStampR | - Reference to other time-stamp |
true
on smaller or equal time-stampReturns true if this time-stamp is less than or equal to time-stamp clTimeStampR, otherwise returns false
.
bool QCanTimeStamp::operator== | ( | const QCanTimeStamp & | clTimeStampR | ) | const |
clTimeStampR | - Reference to other time-stamp |
true
on equal time-stampsReturns true
if this time-stamp is equal to time-stamp clTimeStampR, otherwise returns false
.
bool QCanTimeStamp::operator> | ( | const QCanTimeStamp & | clTimeStampR | ) | const |
clTimeStampR | - Reference to other time-stamp |
true
on greater time-stampReturns true if this time-stamp is greater than time-stamp clTimeStampR, otherwise returns false
.
bool QCanTimeStamp::operator>= | ( | const QCanTimeStamp & | clTimeStampR | ) | const |
clTimeStampR | - Reference to other time-stamp |
true
on greater or equal time-stampReturns true if this time-stamp is greater or equal than time-stamp clTimeStampR, otherwise returns false
.
|
inline |
Returns the seconds part of this time-stamp. A return value of TIME_STAMP_INVALID_VALUE marks the time-stamp value as invalid. The validity of a time-stamp can be tested with isValid().
void QCanTimeStamp::setNanoSeconds | ( | uint32_t | ulNanoSecondsV | ) |
[in] | ulNanoSecondsV | - Nanosecond value |
Set the nanoseconds part of this time-stamp. The value of ulNanoSecondsV must be in the range from 0 to TIME_STAMP_NSEC_LIMIT. If passing a value greater than TIME_STAMP_NSEC_LIMIT the value is limited to TIME_STAMP_NSEC_LIMIT.
void QCanTimeStamp::setSeconds | ( | const uint32_t | ulSecondsV | ) |
[in] | ulSecondsV | - Second value |
Set the seconds part of this time-stamp. The value of ulSecondsV must be in the range from 0 to TIME_STAMP_SECS_LIMIT. If passing a value greater than TIME_STAMP_SECS_LIMIT the value is limited to TIME_STAMP_SECS_LIMIT.
QByteArray QCanTimeStamp::toByteArray | ( | void | ) | const |
The function converts a QCanTimeStamp object to a QByteArray.