trikRuntime
trikKernel::TimeVal Class Reference

Structure of a time value in a convenient format. More...

#include <timeVal.h>

Public Member Functions

 TimeVal (int sec, int mcsec)
 Constructor. More...
 
uint32_t packedUInt32 () const
 Returns packed data that shifted to the left on mShift bits. More...
 

Static Public Member Functions

static TimeVal fromPackedUInt32 (uint32_t packedTime)
 Creates TimeVal using packed data. More...
 
static int timeInterval (int packedTimeLeft, int packedTimeRight)
 Counts time interval between two packed data of time. More...
 

Friends

void * qMetaTypeConstructHelper (const TimeVal *t)
 This method is used in qRegisterMetaType() method and needs default constructor. More...
 
int operator- (const TimeVal &left, const TimeVal &right)
 "Minus" operator is for computing time interval between two timestamps, returns value in microsends. More...
 

Detailed Description

Structure of a time value in a convenient format.

Constructor & Destructor Documentation

TimeVal::TimeVal ( int  sec,
int  mcsec 
)

Constructor.

Parameters represent time in the format - (sec * 10^6 + mcsec) mcsec. Constructor translates this value to the new format - 1 unit of a new value(mTime) is equal to 256 mcsec. Note that after these conversions value in microseconds becomes rounded, but we can neglect this fact in most cases. Formula for translation : mTime = (sec * 10^6 + mcsec) << 8 = sec * 10^6 << mShift + mcsec << mShift = = sec * mSecConst << (mShift - 6) + mcsec << mShift

Member Function Documentation

TimeVal TimeVal::fromPackedUInt32 ( uint32_t  packedTime)
static

Creates TimeVal using packed data.

It needs for hiding one argument constructor of TimeVal from packed data.

uint32_t TimeVal::packedUInt32 ( ) const

Returns packed data that shifted to the left on mShift bits.

int TimeVal::timeInterval ( int  packedTimeLeft,
int  packedTimeRight 
)
static

Counts time interval between two packed data of time.

Friends And Related Function Documentation

int operator- ( const TimeVal left,
const TimeVal right 
)
friend

"Minus" operator is for computing time interval between two timestamps, returns value in microsends.

Parameters
left- a value before sign, usually "time after event".
right- a value after sign, usually "time before event".
void* qMetaTypeConstructHelper ( const TimeVal t)
friend

This method is used in qRegisterMetaType() method and needs default constructor.

It is a friend method for hiding default constructor.


The documentation for this class was generated from the following files: