cwTime.h/cpp : Added elapsedSecs().
This commit is contained in:
parent
53dfdbc2a5
commit
1259ba96fb
13
cwTime.cpp
13
cwTime.cpp
@ -78,6 +78,19 @@ unsigned cw::time::elapsedMs( const spec_t& t0 )
|
||||
return elapsedMs(t0,t1);
|
||||
}
|
||||
|
||||
double cw::time::elapsedSecs( const spec_t& t0, const spec_t& t1 )
|
||||
{
|
||||
return elapsedMicros(t0,t1) / 1000000.0;
|
||||
}
|
||||
|
||||
double cw::time::elapsedSecs( const spec_t& t0 )
|
||||
{
|
||||
spec_t t1;
|
||||
get(t1);
|
||||
return elapsedSecs(t0,t1);
|
||||
}
|
||||
|
||||
|
||||
unsigned cw::time::absElapsedMicros( const spec_t& t0, const spec_t& t1 )
|
||||
{
|
||||
if( isLTE(t0,t1) )
|
||||
|
4
cwTime.h
4
cwTime.h
@ -30,6 +30,10 @@ namespace cw
|
||||
unsigned elapsedMs( const spec_t& t0, const spec_t& t1 );
|
||||
unsigned elapsedMs( const spec_t& t0 );
|
||||
|
||||
// Wrapper on elapsedMicros()
|
||||
double elapsedSecs( const spec_t& t0, const spec_t& t1 );
|
||||
double elapsedSecs( const spec_t& t0 );
|
||||
|
||||
// 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.
|
||||
unsigned absElapsedMicros( const spec_t& t0, const spec_t& t1 );
|
||||
|
Loading…
Reference in New Issue
Block a user