@@ -177,10 +177,13 @@ void run_test_query(struct engineS *engine, const char *query, int max_rows) {
177177
178178 // Execute Insert
179179 clock_t insertStart = clock (); // Start timer for benchmarking
180- if (executeQueryInsertSerial (engine , parsed .table , & r )) {
181- printf ("Insert successful. Execution Time: %ld\n\n" , (clock () - insertStart ) / CLOCKS_PER_SEC );
180+ bool success = executeQueryInsertSerial (engine , parsed .table , & r );
181+ double timeTaken = (double )(clock () - insertStart ) / CLOCKS_PER_SEC ;
182+
183+ if (success ) {
184+ printf ("Insert successful. Execution Time: %.6f\n\n" , timeTaken );
182185 } else {
183- printf ("Insert failed. Execution Time: %ld \n\n" , ( clock () - insertStart ) / CLOCKS_PER_SEC );
186+ printf ("Insert failed. Execution Time: %.6f \n\n" , timeTaken );
184187 }
185188
186189 return ;
@@ -193,12 +196,13 @@ void run_test_query(struct engineS *engine, const char *query, int max_rows) {
193196 // Execute delete
194197 clock_t deleteStart = clock (); // Start timer for benchmarking
195198 struct resultSetS * result = executeQueryDeleteSerial (engine , parsed .table , whereClause );
199+ double timeTaken = (double )(clock () - deleteStart ) / CLOCKS_PER_SEC ;
196200
197201 if (result ) {
198- printf ("Delete successful. Rows affected: %d. Execution Time: %ld \n\n" , result -> numRecords , (( clock () - deleteStart ) / CLOCKS_PER_SEC ) );
202+ printf ("Delete successful. Rows affected: %d. Execution Time: %.6f \n\n" , result -> numRecords , timeTaken );
199203 freeResultSet (result );
200204 } else {
201- printf ("Delete failed. Execution Time: %ld \n\n" , (( clock () - deleteStart ) / CLOCKS_PER_SEC ) );
205+ printf ("Delete failed. Execution Time: %.6f \n\n" , timeTaken );
202206 }
203207
204208 free_where_clause_list (whereClause );
0 commit comments