Commit 291a32c7 authored by Adam Wujek's avatar Adam Wujek 💬

userspace/wrsw_hal: use get_monotonic_* instead of clock_gettime

Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent a978dea1
......@@ -17,6 +17,7 @@
#include <libwr/sfp_lib.h>
#include <libwr/config.h>
#include <libwr/hal_shmem.h>
#include <libwr/util.h>
#include "wrsw_hal.h"
#include <rt_ipc.h>
......@@ -214,7 +215,7 @@ static void hal_parse_cmdline(int argc, char *argv[])
int main(int argc, char *argv[])
{
struct timespec t1, t2;
uint64_t t1, t2;
wrs_msg_init(argc, argv);
......@@ -246,15 +247,14 @@ int main(int argc, char *argv[])
* includes some jitter.
*/
clock_gettime(CLOCK_MONOTONIC, &t1);
t1 = get_monotonic_tics();
for (;;) {
int delay_ms;
hal_update_wripc(25 /* max ms delay */);
clock_gettime(CLOCK_MONOTONIC, &t2);
delay_ms = (t2.tv_sec - t1.tv_sec) * 1000;
delay_ms += (t2.tv_nsec - t1.tv_nsec) / 1000 / 1000;
t2 = get_monotonic_tics();
delay_ms = (t2 - t1) * 1000;
if (delay_ms < PORT_FAN_MS_PERIOD)
continue;
......
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