botsense/bsProxy/bsProxyUtils.c
uint_t timer_elapsed(struct timeval *pTvMark)
{
  struct timeval  tvEnd, tvDelta;

  timer_mark(&tvEnd);

  if( !timerisset(pTvMark) || !timerisset(&tvEnd) )
  {
    return UINT_MAX;
  }

  tvDelta.tv_sec = tvEnd.tv_sec - pTvMark->tv_sec;
  if( tvEnd.tv_usec < pTvMark->tv_usec )
  {
    tvDelta.tv_sec--;
    tvEnd.tv_usec += 1000000;
  }
  tvDelta.tv_usec = tvEnd.tv_usec - pTvMark->tv_usec;

  return (uint_t)(tvDelta.tv_sec * 1000000 + tvDelta.tv_usec);
}
/*! 
 * \brief Calculate the elapsed time between the given time mark and this call.
 *
 * \param pTvMark   Pointer to timeval holding time mark.
 *
 * \return 
 * Number of microseconds elasped. If the marked time is invalid or the current
 * time cannot be ascertained, UINT_MAX is returned.
 */
\brief Calculate the elapsed time between the given time mark and this call.
\param pTvMark   Pointer to timeval holding time mark.

\return
Number of microseconds elasped. If the marked time is invalid or the current
time cannot be ascertained, UINT_MAX is returned.
\ brief Calculate the elapsed time between the given time mark and this call . \ param pTvMark Pointer to timeval holding time mark . \ return Number of microseconds elasped . If the marked time is invalid or the current time cannot be ascertained UINT_MAX is returned .
uint_t timer_elapsed(struct timeval *pTvMark)
{
  struct timeval  tvEnd, tvDelta;
  timer_mark(&tvEnd);
  if( !timerisset(pTvMark) || !timerisset(&tvEnd) )
  {
    return UINT_MAX;
  }
  tvDelta.tv_sec = tvEnd.tv_sec - pTvMark->tv_sec;
  if( tvEnd.tv_usec < pTvMark->tv_usec )
  {
    tvDelta.tv_sec--;
    tvEnd.tv_usec += 1000000;
  }
  tvDelta.tv_usec = tvEnd.tv_usec - pTvMark->tv_usec;
  return (uint_t)(tvDelta.tv_sec * 1000000 + tvDelta.tv_usec);
}
uint_t timer_elapsed ( struct timeval * pTvMark ) { struct timeval tvEnd , tvDelta ; timer_mark ( & tvEnd ) ; if ( ! timerisset ( pTvMark ) || ! timerisset ( & tvEnd ) ) { return UINT_MAX ; } tvDelta . tv_sec = tvEnd . tv_sec - pTvMark -> tv_sec ; if ( tvEnd . tv_usec < pTvMark -> tv_usec ) { tvDelta . tv_sec -- ; tvEnd . tv_usec += 1000000 ; } tvDelta . tv_usec = tvEnd . tv_usec - pTvMark -> tv_usec ; return ( uint_t ) ( tvDelta . tv_sec * 1000000 + tvDelta . tv_usec ) ; }
\brief Calculate the elapsed time between the given time mark and this call.
\ brief Calculate the elapsed time between the given time mark and this call .