diff --git a/examples/rtic_bare3.rs b/examples/rtic_bare3.rs index 84ab978fd011adc0fed2e37c5fc311d99b05ce3a..4e5ce478bb2cc9969bec920bdc08936c0a7685bd 100644 --- a/examples/rtic_bare3.rs +++ b/examples/rtic_bare3.rs @@ -10,8 +10,6 @@ #![no_main] #![no_std] -use core::time::Duration; - use cortex_m_semihosting::hprintln; use panic_semihosting as _; use rtic::cyccnt::Instant; @@ -27,10 +25,12 @@ const APP: () = { wait(1_000_000); let end = Instant::now(); + let diff = Instant::elapsed(&start); + // notice all printing outside of the section to measure! hprintln!("Start {:?}", start).ok(); hprintln!("End {:?}", end).ok(); - let diff = Instant::duration_since(&end,start); + //let diff = Instant::duration_since(&end,start); hprintln!("Diff {:?}", diff.as_cycles()).ok(); } }; @@ -65,7 +65,8 @@ fn wait(i: u32) { // // What is the output in the Adapter Output console? // -// ** your answer here ** +// Start Instant(2694714472) +// End Instant(2698714489) // // As you see line 31 is commented out (we never print the difference). // @@ -79,8 +80,9 @@ fn wait(i: u32) { // // What is now the output in the Adapter Output console? // -// Start Instant(2694714472) -// End Instant(2698714489) +// Start Instant(2100880231) +// End Instant(2104880247) +// Diff 4000016 // // Commit your answers (bare3_1) // @@ -101,7 +103,10 @@ fn wait(i: u32) { // // What is now the output in the Adapter Output console? // -// ** your answer here ** +// Start Instant(2395620599) +// End Instant(2399620615) +// Diff 4000020 + // // Commit your answers (bare3_3) //