(trunk libT) removed dead code: tr_isTimeval(), tr_timevalMsec(), tr_timevalSet()

This commit is contained in:
Charles Kerr 2009-12-12 01:05:29 +00:00
parent 1f320b2ddd
commit ed1df8beac
3 changed files with 10 additions and 38 deletions

View File

@ -84,8 +84,8 @@ static void
nap( int roughly )
{
struct timeval tv;
tr_timevalSet( &tv, roughly / 2 + tr_cryptoWeakRandInt( roughly ),
tr_cryptoWeakRandInt( 1000000 ) );
tv.tv_sec = roughly / 2 + tr_cryptoWeakRandInt( roughly );
tv.tv_usec = tr_cryptoWeakRandInt( 1000000 );
select( 0, NULL, NULL, NULL, &tv );
}

View File

@ -465,38 +465,18 @@ tr_strip_positional_args( const char* str )
***
**/
tr_bool
tr_isTimeval( const struct timeval * tv )
{
return tv && ( tv->tv_sec >= 0 )
&& ( tv->tv_usec >= 0 )
&& ( tv->tv_usec < 1000000 );
}
void
tr_timevalMsec( uint64_t milliseconds, struct timeval * setme )
{
const uint64_t microseconds = milliseconds * 1000;
assert( setme != NULL );
setme->tv_sec = microseconds / 1000000;
setme->tv_usec = microseconds % 1000000;
assert( tr_isTimeval( setme ) );
}
void
tr_timevalSet( struct timeval * setme, int seconds, int microseconds )
{
setme->tv_sec = seconds;
setme->tv_usec = microseconds;
assert( tr_isTimeval( setme ) );
}
void
tr_timerAdd( struct event * timer, int seconds, int microseconds )
{
struct timeval tv;
tr_timevalSet( &tv, seconds, microseconds );
event_add( timer, &tv );
tv.tv_sec = seconds;
tv.tv_usec = microseconds;
assert( tv.tv_sec >= 0 );
assert( tv.tv_usec >= 0 );
assert( tv.tv_usec < 1000000 );
evtimer_add( timer, &tv );
}
void

View File

@ -253,14 +253,6 @@ uint8_t* tr_loadFile( const char * filename, size_t * size ) TR_GNUC_MALLOC TR_G
char* tr_buildPath( const char * first_element, ... ) TR_GNUC_NULL_TERMINATED
TR_GNUC_MALLOC;
struct timeval;
tr_bool tr_isTimeval( const struct timeval * tv );
void tr_timevalMsec( uint64_t milliseconds, struct timeval * setme );
void tr_timevalSet( struct timeval * setme, int seconds, int microseconds );
struct event;
void tr_timerAdd( struct event * timer, int seconds, int microseconds );