cmTime.h : Added function cmTimeAbsElapsedMicros().
This commit is contained in:
parent
e2a2295be6
commit
50677f8f0f
12
cmTime.c
12
cmTime.c
@ -59,3 +59,15 @@ unsigned cmTimeElapsedMicros( const cmTimeSpec_t* t0, const cmTimeSpec_t* t1 )
|
|||||||
// take diff between t1 and t0
|
// take diff between t1 and t0
|
||||||
return u1 - u0;
|
return u1 - u0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned cmTimeAbsElapsedMicros( const cmTimeSpec_t* t0, const cmTimeSpec_t* t1 )
|
||||||
|
{
|
||||||
|
if( t1->tv_sec > t0->tv_sec )
|
||||||
|
return cmTimeElapsedMicros(t0,t1);
|
||||||
|
|
||||||
|
if( t1->tv_sec == t0->tv_sec )
|
||||||
|
if( t1->tv_nsec > t0->tv_nsec )
|
||||||
|
return cmTimeElapsedMicros(t0,t1);
|
||||||
|
|
||||||
|
return cmTimeElapsedMicros(t1,t0);
|
||||||
|
}
|
||||||
|
15
cmTime.h
15
cmTime.h
@ -24,16 +24,15 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
void cmTimeGet( cmTimeSpec_t* t );
|
void cmTimeGet( cmTimeSpec_t* t );
|
||||||
|
|
||||||
// Return the elapsed time (t1 - t0)
|
// Return the elapsed time (t1 - t0) in microseconds
|
||||||
// in microseconds
|
// t1 is assumed to be at a later time than t0.
|
||||||
unsigned cmTimeElapsedMicros
|
unsigned cmTimeElapsedMicros( const cmTimeSpec_t* t0, const cmTimeSpec_t* t1 );
|
||||||
(
|
|
||||||
const
|
|
||||||
cmTimeSpec_t*
|
|
||||||
t0, //< ptr to start time
|
|
||||||
const cmTimeSpec_t* t1 );// ptr to end time
|
|
||||||
|
|
||||||
|
|
||||||
|
// Same as cmTimeElapsedMicros() but the times are not assumed to be ordered.
|
||||||
|
// The function therefore begins by swapping t1 and t0 if t0 is after t1.
|
||||||
|
unsigned cmTimeAbsElapsedMicros( const cmTimeSpec_t* t0, const cmTimeSpec_t* t1 );
|
||||||
|
|
||||||
//)
|
//)
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user