diff options
Diffstat (limited to 'examples/ini_file_read.c')
| -rw-r--r-- | examples/ini_file_read.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/examples/ini_file_read.c b/examples/ini_file_read.c index b54bebd..2775986 100644 --- a/examples/ini_file_read.c +++ b/examples/ini_file_read.c @@ -5,6 +5,7 @@ #include <stdio.h> #include <stdlib.h> +#include <time.h> #include "../ini_file.h" @@ -20,11 +21,15 @@ int error_callback(const char *const filename, const size_t line_number, const s int main(const int argc, const char **const argv) { struct Ini_File *ini_file; + clock_t start_time, end_time; + double total_time; if (argc < 2) { fprintf(stderr, "Usage: %s ini_file_name\n", argv[0]); return EXIT_FAILURE; } + start_time = clock(); ini_file = ini_file_parse(argv[1], error_callback); + end_time = clock(); if (ini_file == NULL) { fprintf(stderr, "Was not possible to parse the ini_file \"%s\"\n", argv[1]); return EXIT_FAILURE; @@ -33,6 +38,8 @@ int main(const int argc, const char **const argv) { ini_file_print_to(ini_file, stdout); printf("\nCheck out this information of the INI file data structure:\n"); ini_file_info(ini_file); + total_time = 1000.0 * ((double)(end_time - start_time)) / CLOCKS_PER_SEC; + printf("Time needed to parse the INI file: %f ms\n\n", total_time); ini_file_free(ini_file); return EXIT_SUCCESS; } |
