expanded accounting-event coverage, rewrote cycle timing
[dcpu16] / common.h
index 02db4d77fdc131f63166d63d9cdb5d0ecca7d73c..09e1509c96eec5eab8961163dd70cecf8596c039 100644 (file)
--- a/common.h
+++ b/common.h
@@ -2,6 +2,7 @@
 #define COMMON_H_QPRCB1BH
 
 #include <stdlib.h>
+#include <time.h>
 
 struct dynamic_array {
     size_t entry_size;
@@ -16,11 +17,14 @@ struct dynamic_array {
 int dynarray_init(struct dynamic_array *da, size_t entry_size, size_t grow_size);
 struct dynamic_array *dynarray_new(size_t entry_size, size_t grow_size);
 void *dynarray_add(struct dynamic_array *da, void *item);
+void dynarray_empty(struct dynamic_array *da, void (*free_element)(void *));
 
 int str_to_word(char *s);
 
 char *strqtok_r(char *str, const char *sep, int esc, const char *quote, char **lastq, char **lasts);
 
-int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y);
+int gettimespecofday(struct timespec *ts);
+int timespec_add(struct timespec *result, const struct timespec *x);
+int timespec_subtract(struct timespec *result, struct timespec *x, struct timespec *y);
 
 #endif /* COMMON_H_QPRCB1BH */