guild icon
Toit
#Wrong duration after Reset ?
Thread channel in help
kaxori
kaxori 09/14/2023 10:09 AM
After HW Reset wrong runtime duration is calculated ?
kaxori
kaxori 09/14/2023 10:18 AM
=> jag container install APP src/testDuration.toit --device Bread-Board
erikcorry
erikcorry 09/14/2023 10:38 AM
The system clock was set with NTP after you recorded the initial time.
erikcorry
erikcorry 09/14/2023 10:41 AM
main: start := Time.monotonic-us sleep --ms=1234 end := Time.monotonic-us print Duration --us=(end - start)

If you don't want the time affected by the clock then you need to use monotonic-us like this.
erikcorry
erikcorry 09/14/2023 10:41 AM
Monotonic-us is not affected by the clock being set, it always goes forwards at the same speed.
erikcorry
erikcorry 09/14/2023 10:43 AM
(If you have an older Toit then it's called monotonic_us with an underscore.)
kaxori
kaxori 09/14/2023 10:43 AM
:👍🏻: Thank you.
(Learned something again)
erikcorry
erikcorry 09/14/2023 10:43 AM
:🙂:
8 messages in total