Skip to content
Snippets Groups Projects
Commit 50dbe97e authored by Blinningjr's avatar Blinningjr
Browse files

Fixed my answere for question 2 in timing_exam

parent df457cd3
No related branches found
No related tags found
No related merge requests found
......@@ -176,8 +176,11 @@ const APP: () = {
// `cx.schedule.t1(cx.scheduled + 100_000.cycles()).unwrap();`
//
// [Your answer here]
// Instant::now() may have drift/jitter, meaning that it is not completely accurate.
// cx.scheduled has zero drift/jitter, thus it is accurate.
// The main difference is that `Instant::now()` returns the current time in cycles and
// `cx.scheduled` returns the time the task is scheduled for in cycles.
//
// Another difference is that `Instant::now()` may have drift/jitter, meaning that it is not completely accurate.
// `cx.scheduled` has zero drift/jitter, thus it is accurate.
//
//
// Source: https://rtic.rs/0.5/book/en/by-example/timer-queue.html
......@@ -187,9 +190,13 @@ const APP: () = {
// in order to generate a periodic task.
//
// [Your answer here]
// If we would use Instant::now() the timing of the periodic tasks would be a little inaccurate
// because Instant::now() has a little drift/jitter. cx.scheduled has zero drift/jitter and thus
// will have accurate timing of the periodic tasks.
// The main reason is that `Instant::now()` returns the current time which will not be equal to the
// start time of the task if the task is preempted by other tasks. But `cx.scheduled` returns the
// scheduled time of the task thus it will always return the correct value, even if the task is
// preempted.
//
// Another reason is that `Instant:now()` has some drift/jitter which causes the timing of the periods to be inaccurate.
// But `cx.scheduled` has zero drift/jitter, thus making it better.
//
//
// Hint, look at https://rtic.rs/0.5/book/en/by-example/timer-queue.html
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment