@@ -169,7 +169,7 @@ int main(int argc, char *argv[]) {
169169 #pragma omp barrier
170170
171171 // End timer for engine initialization
172- double initTimeTaken = (( double ) omp_get_wtime () - totalStart ) / CLOCKS_PER_SEC ;
172+ double initTimeTaken = omp_get_wtime () - totalStart ;
173173
174174 // Load the COMMANDS into memory (from COMMAND text file)
175175 const char * query_file = "sample-queries.txt" ;
@@ -203,7 +203,7 @@ int main(int argc, char *argv[]) {
203203 fclose (fp );
204204
205205 // End timer for loading queries
206- double loadTimeTaken = (( double ) omp_get_wtime () - totalStart ) / CLOCKS_PER_SEC ;
206+ double loadTimeTaken = omp_get_wtime () - totalStart ;
207207
208208 // Split queries into an array to avoid strtok race conditions
209209 #define MAX_QUERIES 1000
@@ -279,7 +279,7 @@ int main(int argc, char *argv[]) {
279279 free_where_clause_list (whereClause );
280280 }
281281
282- execTime = ( double )( omp_get_wtime () - start ) / CLOCKS_PER_SEC ;
282+ execTime = omp_get_wtime () - start ;
283283 } else {
284284 parseFailed = true;
285285 }
@@ -296,15 +296,15 @@ int main(int argc, char *argv[]) {
296296 if (parsed .num_values != 12 ) {
297297 printf ("Error: INSERT requires exactly 12 values.\n" );
298298 } else if (success ) {
299- printf ("Insert successful. Execution Time: %ld \n\n" , ( long ) execTime );
299+ printf ("Insert successful. Execution Time: %.4f seconds \n\n" , execTime );
300300 } else {
301- printf ("Insert failed. Execution Time: %ld \n\n" , ( long ) execTime );
301+ printf ("Insert failed. Execution Time: %.4f seconds \n\n" , execTime );
302302 }
303303 } else if (parsed .command == CMD_DELETE ) {
304304 if (result ) {
305- printf ("Delete successful. Rows affected: %d. Execution Time: %ld \n\n" , rowsAffected , ( long ) execTime );
305+ printf ("Delete successful. Rows affected: %d. Execution Time: %.4f seconds \n\n" , rowsAffected , execTime );
306306 } else {
307- printf ("Delete failed. Execution Time: %ld \n\n" , ( long ) execTime );
307+ printf ("Delete failed. Execution Time: %.4f seconds \n\n" , execTime );
308308 }
309309 } else if (parsed .command == CMD_SELECT ) {
310310 printTable (NULL , result , ROW_LIMIT );
@@ -325,7 +325,7 @@ int main(int argc, char *argv[]) {
325325 destroyEngineOMP (engine );
326326
327327 // Print total runtime statistics in pretty colors
328- double totalTimeTaken = (( double ) omp_get_wtime () - totalStart ) / CLOCKS_PER_SEC ;
328+ double totalTimeTaken = omp_get_wtime () - totalStart ;
329329 printf (CYAN "======= Execution Summary =======" RESET "\n" );
330330 printf (CYAN "Engine Initialization Time: " RESET YELLOW "%.4f seconds\n" RESET , initTimeTaken );
331331 printf (CYAN "Query Loading Time: " RESET YELLOW "%.4f seconds\n" RESET , loadTimeTaken - initTimeTaken );
0 commit comments