summaryrefslogtreecommitdiff
path: root/tests/test_helpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_helpers.h')
-rw-r--r--tests/test_helpers.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_helpers.h b/tests/test_helpers.h
new file mode 100644
index 0000000..6065de8
--- /dev/null
+++ b/tests/test_helpers.h
@@ -0,0 +1,21 @@
+#ifndef FASTFORGE_TEST_HELPERS_H
+#define FASTFORGE_TEST_HELPERS_H
+
+#include <time.h>
+
+static inline time_t make_utc_time(int year, int month, int day,
+ int hour, int minute, int second) {
+ struct tm tm_value;
+ tm_value.tm_year = year - 1900;
+ tm_value.tm_mon = month - 1;
+ tm_value.tm_mday = day;
+ tm_value.tm_hour = hour;
+ tm_value.tm_min = minute;
+ tm_value.tm_sec = second;
+ tm_value.tm_wday = 0;
+ tm_value.tm_yday = 0;
+ tm_value.tm_isdst = -1;
+ return mktime(&tm_value);
+}
+
+#endif