diff options
author | Aaron Ball <nullspoon@oper.io> | 2016-11-28 15:02:33 -0700 |
---|---|---|
committer | Aaron Ball <nullspoon@oper.io> | 2016-11-28 15:02:38 -0700 |
commit | b24df58e244ba5eb84749fc1985a8ddd5bc3f206 (patch) | |
tree | 1531f206180cbd03c5b20052dde366a5533928a0 | |
parent | ffa29bb57ff5555d2aab7d2b1750e8ff10c99d73 (diff) | |
parent | 7be0c13884b2a220e1d90a4ef6ce1c3f2690dcbe (diff) | |
download | palindrome_finder-master.tar.gz palindrome_finder-master.tar.xz |
Signed-off-by: Aaron Ball <nullspoon@oper.io>
-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; } |