forked from ARMmbed/mbed-os
-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Labels
Description
In timer.h some methods are defined to return the absolute time for a timer object. Some of them are depreciated becasue they do not return a data type within the full range:
Note: INFO macro expands to a printf
Timer int_t;
int_t.start();
INFO("Timer: %u ms", int_t.read_ms()); // depreciated
// is implemented as:
INFO("Timer: %u ms", std::chrono::duration_cast<std::chrono::duration<int, std::milli>>(int_t.elapsed_time()).count()); // depreciated
As decribed in time.h there are better options, but not yet incorporated in the code:
INFO("Timer: %llu ms", std::chrono::duration_cast<std::chrono::milliseconds>(int_t.elapsed_time()).count()); // 64bit value
INFO("Timer: %llu us", static_cast<long long int>(int_t.elapsed_time().count())); //64bit value
2^64 | |
---|---|
1,84467E+19 | us |
1,84467E+16 | ms |
1,84467E+13 | s |
3,07446E+11 | min |
5124095576 | h |
213503982,3 | d |
584554,531 | y |