Commit 067cd537 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Implement roughly.

parent 42ea5c40
......@@ -63,6 +63,12 @@ seqno_plus(unsigned short s, int plus)
return ((s + plus) & 0xFFFF);
}
int
roughly(int value)
{
return value * 3 / 4 + random() % (value / 2);
}
/* Like gettimeofday, but should return monotonic time. If POSIX clocks
are not available, falls back to gettimeofday. */
int
......
......@@ -26,6 +26,7 @@ int seqno_minus(unsigned short s1, unsigned short s2)
ATTRIBUTE ((const));
unsigned short seqno_plus(unsigned short s, int plus)
ATTRIBUTE ((const));
int roughly(int value);
int gettime(struct timeval *tv);
void timeval_minus(struct timeval *d,
const struct timeval *s1, const struct timeval *s2);
......
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