Commit 1f38f69b authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

Timestamps of immediate trigger is no longer a nanosecond counter.

This makes testcases more reliable and enables us to find stupid time
calculation mixups.
parent e6393f46
......@@ -22,11 +22,20 @@
static uint64_t interval;
static controller_trigger_time t;
static controller_trigger_time ts2timestamp(struct timespec *ts)
{
return ((uint64_t)ts->tv_nsec + (uint64_t)ts->tv_sec * 1000000000) / 200;
}
static int wait_init_default(struct controller_trigger *trigger, struct timespec *ts_interval)
{
interval = ts_interval->tv_sec * 1000000000 + ts_interval->tv_nsec;
interval = ts2timestamp(ts_interval);
t = 0x1234beefull * 1000000000;
struct timespec ts;
ts.tv_sec = 946684800;
ts.tv_nsec = 0;
t = ts2timestamp(&ts);
return 0;
}
......@@ -50,14 +59,11 @@ static int overruns(struct controller_trigger *trigger)
static void timestamp2timespec(struct timespec *ts, controller_trigger_time ct)
{
ct *= 200;
ts->tv_sec = ct / 1000000000;
ts->tv_nsec = ct % 1000000000;
}
static controller_trigger_time ts2timestamp(struct timespec *ts)
{
return ts->tv_nsec + ts->tv_sec * 1000000000;
}
static struct controller_trigger trigger_default = {
.init = wait_init_default,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment