From ff15e0fa53156b9994da3f726bfe91232de6195a Mon Sep 17 00:00:00 2001 From: kpfleming Date: Fri, 15 Jul 2005 23:00:47 +0000 Subject: add a library of timeval manipulation functions, and change a large number of usses to use the new functions (bug #4504) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6146 f38db490-d61c-443f-a65b-d21fe96a405b --- apps/app_test.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'apps/app_test.c') diff --git a/apps/app_test.c b/apps/app_test.c index bbb54c192..44508063a 100755 --- a/apps/app_test.c +++ b/apps/app_test.c @@ -55,7 +55,7 @@ static int measurenoise(struct ast_channel *chan, int ms, char *who) int samples=0; int x; short *foo; - struct timeval start, tv; + struct timeval start; struct ast_frame *f; int rformat; rformat = chan->readformat; @@ -63,11 +63,9 @@ static int measurenoise(struct ast_channel *chan, int ms, char *who) ast_log(LOG_NOTICE, "Unable to set to linear mode!\n"); return -1; } - gettimeofday(&start, NULL); + start = ast_tvnow(); for(;;) { - gettimeofday(&tv, NULL); - mssofar = (tv.tv_sec - start.tv_sec) * 1000; - mssofar += (tv.tv_usec - start.tv_usec) / 1000; + mssofar = ast_tvdiff_ms(ast_tvnow(), start); if (mssofar > ms) break; res = ast_waitfor(chan, ms - mssofar); -- cgit v1.2.3