#include
void wait ( double seconds )
{
clock_t start = clock();
while ( clock() < start + ( seconds * CLOCKS_PER_SEC ) )
;
}
/* For symmetry with stop_timer */
clock_t start_timer ( void )
{
return clock();
}
double stop_timer ( clock_t start )
{
return ( (double)clock() - start ) / CLOCKS_PER_SEC;
}
int main ( void )
{
clock_t start;
puts ( "Running" );
start = start_timer();
wait ( 2.2 );
printf ( "Done after %f seconds\n", stop_timer ( start ) );
return 0;
}
EmoticonEmoticon