[riot-notifications] [RIOT-OS/RIOT] tests/xtimer_usleep: recognize negative offset (#11493)

Gaëtan Harter notifications at github.com
Tue May 7 14:56:54 CEST 2019


> > When we say `sleep 10us` it should sleep at least ~`10s`~ `10us`~.
> 
> More like "as close to 10us as possible". 9.99us is more accurate than 10.02.


So in a timesloted networking protocol if I say:

```
next_timeslot_start = now + convert(10ms);
sleep_until(timeslot_start); // or with delay, its for the idea
send_packet();
```

I may just send in the previous timeslot everytime.

I do not feel it more accurate to send a message before I am allowed to.
I do not feel it more accurate to write to a hardware before its ready.


That MUST be documented in the API and tell how to proceed if one wants to be sure that he can do:

```
t0 = now();
timer_set(10ms, callback, arg=t0);

and have an the callback:
t0 = arg;
assert(now() > t0 + 10ms);
```

>From the timer libraries I remember, they were all more ensuring it is done at least after/waits longer than the time specified. Like `posix` guarantees.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11493#issuecomment-490067918
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190507/1f00c1cb/attachment.html>


More information about the notifications mailing list