cwTime.cpp/h : Added elapsedMs()
This commit is contained in:
parent
5927fcb43b
commit
3ef020648b
@ -61,6 +61,10 @@ unsigned cw::time::elapsedMicros( const spec_t* t0, const spec_t* t1 )
|
|||||||
return u1 - u0;
|
return u1 - u0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned cw::time::elapsedMs( const spec_t* t0, const spec_t* t1 )
|
||||||
|
{ return elapsedMicros(t0,t1)/1000; }
|
||||||
|
|
||||||
|
|
||||||
unsigned cw::time::absElapsedMicros( const spec_t* t0, const spec_t* t1 )
|
unsigned cw::time::absElapsedMicros( const spec_t* t0, const spec_t* t1 )
|
||||||
{
|
{
|
||||||
if( isLTE(t0,t1) )
|
if( isLTE(t0,t1) )
|
||||||
|
2
cwTime.h
2
cwTime.h
@ -25,6 +25,8 @@ namespace cw
|
|||||||
// t1 is assumed to be at a later time than t0.
|
// t1 is assumed to be at a later time than t0.
|
||||||
unsigned elapsedMicros( const spec_t* t0, const spec_t* t1 );
|
unsigned elapsedMicros( const spec_t* t0, const spec_t* t1 );
|
||||||
|
|
||||||
|
// Wrapper on elapsedMicros()
|
||||||
|
unsigned elapsedMs( const spec_t* t0, const spec_t* t1 );
|
||||||
|
|
||||||
// Same as elapsedMicros() but the times are not assumed to be ordered.
|
// Same as elapsedMicros() but the times are not assumed to be ordered.
|
||||||
// The function therefore begins by swapping t1 and t0 if t0 is after t1.
|
// The function therefore begins by swapping t1 and t0 if t0 is after t1.
|
||||||
|
Loading…
Reference in New Issue
Block a user