summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 479c48b..69f297e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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;
}

Generated by cgit