diff --git a/text_rendering/generic_hash.h b/text_rendering/generic_hash.h index a1c7308..99e134f 100644 --- a/text_rendering/generic_hash.h +++ b/text_rendering/generic_hash.h @@ -123,7 +123,7 @@ struct htname##_entry * htname##_insert(struct htname##_ref *ht, struct htname## } \ \ \ -struct htname##_ref * htname##_remove(struct htname##_ref *ht, codetype code) \ +struct htname##_entry * htname##_remove(struct htname##_ref *ht, codetype code)\ { \ if (!ht) return NULL; \ struct htname##_entry *r = htname##_search(ht, code); \ diff --git a/text_rendering/util.c b/text_rendering/util.c index 2d68db8..2fbb03e 100644 --- a/text_rendering/util.c +++ b/text_rendering/util.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "util.h" @@ -108,3 +109,18 @@ void print_byte(unsigned char byte) { printf("%s%s", bit_rep[byte >> 4], bit_rep[byte & 0x0F]); } + + +static struct timespec clock_start, clock_stop; + +void stopwatch_start(void) +{ + clock_gettime(CLOCK_MONOTONIC_COARSE, &clock_start); +} + + +double stopwatch_get(void) +{ + clock_gettime(CLOCK_MONOTONIC_COARSE, &clock_stop); + return (clock_stop.tv_sec-clock_start.tv_sec)+(double)(clock_stop.tv_nsec-clock_start.tv_nsec)/(double)1000000000L; +} \ No newline at end of file diff --git a/text_rendering/util.h b/text_rendering/util.h index fe254ea..fcfdbaa 100644 --- a/text_rendering/util.h +++ b/text_rendering/util.h @@ -15,4 +15,7 @@ void dump_file(const char *path, char **buf, int *buf_len); void print_byte(unsigned char byte); +void stopwatch_start(void); +double stopwatch_get(void); + #endif