Mistake on this page?
Report an issue in GitHub or email us
OsClock Struct Reference

A C++11 chrono TrivialClock for os_timer. More...

#include <mbed_os_timer.h>

Detailed Description

A C++11 chrono TrivialClock for os_timer.

Due to the nature of OsTimer/SysTimer, this does not have a single now method, but has multiple ways to report the current state:

 High-res timeline -------------------------------------------------------------
 Ticks               |  a  |  b  |  b  |  b  |  c  |  c  |  c  |  c  |  c  | d ^
                           ^                 ^                             ^   os_timer->get_time()
                    acknowledged_ticks()   reported_ticks()               now()

(a) is time read from hardware by OsTimer, reported to the user of OsTimer, and acknowledged by that user. (b) is time read from hardware by OsTimer, reported to the user of OsTimer, but not yet acknowledged. (c) is time already elapsed in the hardware but yet to be read and processed as ticks by OsTimer. (d) is time already elapsed in the hardware that doesn't yet form a tick.

Time is "reported" either by:

As such now() is used when the ticker is not in use - it processes ticks that would have been processed by the tick handler. If the ticker is in uses reported_ticks or acknowleged_ticks must be used.

Note
To fit better into the chrono framework, OsClock uses chrono::milliseconds as its representation, which makes it signed and at least 45 bits, so it will be int64_t or equivalent, unlike OsTimer which uses uint64_t rep.

Definition at line 71 of file mbed_os_timer.h.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.