diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -160,11 +160,11 @@ int main(int argc, char *argv[]) { free(data); - // Calculate runtime - long int secs = stop.tv_sec - start.tv_sec; - long int nano = stop.tv_nsec - start.tv_nsec; + // Calculate search time + double timestart = start.tv_sec + (1.0e-9 * start.tv_nsec); + double timestop = stop.tv_sec + (1.0e-9 * stop.tv_nsec); // Print runtime message - printf("Palindrome search took %ld.%ld seconds\n", secs, nano / 10000); + printf("Palindrome search took %.5f seconds\n", timestop - timestart); return 0; } |