Commit 14a94373 authored by Adam Wujek's avatar Adam Wujek 💬

userspace/tools: use monotonic clock in load-virtex

Proper timeout will not work when clock is set to the past.
It is unlikely that problem pop up here, but just to be safe.
Problem simillar to bug 1164.

Check commit:
userspace/snmpd: bugfix 1164, replace time() with monotinic version
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 4f817bed
......@@ -88,12 +88,12 @@ static int pio_get(int port, int bit)
static void ud(int usecs) /* horrible udelay thing without scheduling */
{
struct timeval tv1, tv2;
gettimeofday(&tv1, NULL);
struct timespec tv1, tv2;
clock_gettime(CLOCK_MONOTONIC, &tv1);
do
gettimeofday(&tv2, NULL);
clock_gettime(CLOCK_MONOTONIC, &tv2);
while ((tv2.tv_sec - tv1.tv_sec) * 1000*1000
+ tv2.tv_usec - tv1.tv_usec < usecs);
+ (tv2.tv_nsec - tv1.tv_nsec) / 1000 < usecs);
}
......
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