diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2013-07-04 16:58:14 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2013-07-04 16:58:14 +0200 |
commit | 8c04f3936822c13acdb6711ccd3159395a96ee0b (patch) | |
tree | 571f9e0b19a1034df0aa92517a623f3c8a870b00 /test/timer.c | |
parent | b9ce6027dde8b3c6fd002d38e3cee07e7711d73c (diff) | |
download | ufodecode-8c04f3936822c13acdb6711ccd3159395a96ee0b.tar.gz ufodecode-8c04f3936822c13acdb6711ccd3159395a96ee0b.tar.bz2 ufodecode-8c04f3936822c13acdb6711ccd3159395a96ee0b.tar.xz ufodecode-8c04f3936822c13acdb6711ccd3159395a96ee0b.zip |
Make Timer private and calculate elapsed seconds
Diffstat (limited to 'test/timer.c')
-rw-r--r-- | test/timer.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/timer.c b/test/timer.c index 43aff84..987f18d 100644 --- a/test/timer.c +++ b/test/timer.c @@ -1,6 +1,12 @@ #include <stdlib.h> #include "timer.h" +struct _Timer { + struct timeval start; + long seconds; + long useconds; +}; + Timer * timer_new (void) @@ -31,3 +37,9 @@ timer_stop (Timer *t) t->seconds += end.tv_sec - t->start.tv_sec; t->useconds += end.tv_usec - t->start.tv_usec; } + +double +timer_get_seconds (Timer *t) +{ + return t->seconds + t->useconds / 1000.0 / 1000.0; +} |