From 14d2ca26b3abd0feb20f270c66847b7b2c17cb0a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 24 Nov 2009 10:36:52 +0100 Subject: s3:dbwrap_torture: use timeval_current/timeval_elapsed instead of start_timer/end_timer metze --- source3/utils/dbwrap_torture.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/source3/utils/dbwrap_torture.c b/source3/utils/dbwrap_torture.c index 2077eea567..a6e2d2bc2c 100644 --- a/source3/utils/dbwrap_torture.c +++ b/source3/utils/dbwrap_torture.c @@ -33,20 +33,6 @@ extern bool AllowDebugChange; -static struct timeval tp1,tp2; - -static void start_timer(void) -{ - gettimeofday(&tp1,NULL); -} - -static double end_timer(void) -{ - gettimeofday(&tp2,NULL); - return (tp2.tv_sec + (tp2.tv_usec*1.0e-6)) - - (tp1.tv_sec + (tp1.tv_usec*1.0e-6)); -} - #define DEFAULT_DB_NAME "transaction.tdb" static int timelimit = 10; @@ -138,12 +124,13 @@ static void test_store_records(struct db_context *db, struct tevent_context *ev) TDB_DATA key; uint32_t *counters; TALLOC_CTX *tmp_ctx = talloc_stackframe(); + struct timeval start; key.dptr = (unsigned char *)discard_const("testkey"); key.dsize = strlen((const char *)key.dptr)+1; - start_timer(); - while ((timelimit == 0) || (end_timer() < timelimit)) { + start = timeval_current(); + while ((timelimit == 0) || (timeval_elapsed(&start) < timelimit)) { struct db_record *rec; TDB_DATA data; int ret; -- cgit