Commit 376a7d06 authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾

motor-control: switch to CLOCK_TAI

switch all CLOCK_REALTIME references to CLOCK_TAI
parent b70065ce
......@@ -148,7 +148,7 @@ static void *packet_sending_thread(void *p) {
}
clock_gettime(CLOCK_MONOTONIC, &measures_start);
clock_gettime(CLOCK_REALTIME, &next);
clock_gettime(CLOCK_TAI, &next);
if (thread_params.start_ts) {
if (thread_params.start_ts < ts_to_uint(next)) {
......@@ -182,7 +182,7 @@ static void *packet_sending_thread(void *p) {
nb_cycles >= ((unsigned int)thread_params.max_cycles))
break;
clock_gettime(CLOCK_REALTIME, &current);
clock_gettime(CLOCK_TAI, &current);
// Sanity check
if(current.tv_sec > next.tv_sec)
......@@ -190,7 +190,7 @@ static void *packet_sending_thread(void *p) {
if(current.tv_sec == next.tv_sec && current.tv_nsec > next.tv_nsec)
goto invalid_ts;
ret = clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &next, NULL);
ret = clock_nanosleep(CLOCK_TAI, TIMER_ABSTIME, &next, NULL);
if (ret) {
fprintf(stderr, "clock_nanosleep returned error: %d, aborting...\n", ret);
exit(EXIT_FAILURE);
......@@ -200,7 +200,7 @@ static void *packet_sending_thread(void *p) {
encode(tx_data, send_data);
// Get timestamp before TSN task for stats
clock_gettime(CLOCK_REALTIME, &current);
clock_gettime(CLOCK_TAI, &current);
do_tsn_task(send_data, next_txtime);
add_ns(&next, thread_params.interval);
......
......@@ -76,7 +76,7 @@ void init_udp_send(egress_info_t *info) {
error(EXIT_FAILURE, errno, "setsockopt SO_BINDTODEVICE failed\n");
if (params->use_etf) {
info->sk_txtime.clockid = CLOCK_REALTIME;
info->sk_txtime.clockid = CLOCK_TAI;
info->sk_txtime.flags = SOF_TXTIME_REPORT_ERRORS;
if (setsockopt(info->sock_fd, SOL_SOCKET, SO_TXTIME, &info->sk_txtime,
......
......@@ -129,7 +129,7 @@ static void *emit_signal_thread(void *p) {
continue;
}
ret = clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &emit_signal_next, NULL);
ret = clock_nanosleep(CLOCK_TAI, TIMER_ABSTIME, &emit_signal_next, NULL);
if (ret) {
fprintf(stderr, "clock_nanosleep returned error: %d, aborting...\n", ret);
exit(EXIT_FAILURE);
......@@ -145,7 +145,7 @@ static void *emit_signal_thread(void *p) {
gpio_pulse_state = toggle_gpio(gpio_pulse_fd, gpio_pulse_state);
}
clock_gettime(CLOCK_REALTIME, &current);
clock_gettime(CLOCK_TAI, &current);
previous_emit = current;
previous_ts = emit_signal_next;
......@@ -177,7 +177,7 @@ static void *tsn_thread(void *p) {
if (tsn_task == XDP_TASK) setup_poll_fd();
if (thread_params.start_ts) {
clock_gettime(CLOCK_REALTIME, &next);
clock_gettime(CLOCK_TAI, &next);
if (thread_params.start_ts < ts_to_uint(next)) {
fprintf(stderr, "start timestamp is in the past, aborting...\n");
exit(EXIT_FAILURE);
......@@ -199,7 +199,7 @@ static void *tsn_thread(void *p) {
recv_xdp_packet();
// Get time for statistics
clock_gettime(CLOCK_REALTIME, &current);
clock_gettime(CLOCK_TAI, &current);
recv_xdp_cleanup();
interval_us = calcdiff_ns(current, previous) / 1000;
......
Markdown is supported
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