Skip to content

Commit ed7e6a7

Browse files
authored
Minor Chrono updates (#1302)
1 parent 839aee7 commit ed7e6a7

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

docs/api/io/Timer.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
<span class="images">![](../../images/classmbed_1_1_timer.png)<span>Timer class hierarchy</span></span>
44

5-
Use the Timer interface to create, start, stop and read a timer for measuring precise times (better than millisecond precision).
5+
Use the Timer interface to create, start, stop and read a stopwatch-like timer for measuring precise times (better than millisecond precision).
66

77
You can independently create, start and stop any number of Timer objects.
88

99
## Warnings and notes
1010

11-
- Timers are based on 64-bit unsigned microsecond counters, but for backward compatibility, the `read_ms()` and `read_us()` methods only return 32-bit signed integers. This limits their range before wrapping to 49 days and 35 minutes respectively. Use `read_high_resolution_us()` to access the full range of over 500,000 years.
12-
- While a Timer is running, deep sleep is blocked to maintain accurate timing. If you don't need microsecond precision, consider using the LowPowerTimer class instead because this does not block deep sleep mode.
11+
- Timers are based on 64-bit signed microsecond counters, giving a range of over 250,000 years.
12+
- While a Timer is running, deep sleep is blocked to maintain accurate timing. If you don't need microsecond precision, consider using the LowPowerTimer or Kernel::Clock classes instead because these do not block deep sleep mode.
1313

1414
## Timer class reference
1515

docs/api/rtos/Kernel.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ The Kernel namespace implements interfaces to attach a function to some kernel e
66

77
[![View code](https://www.mbed.com/embed/?type=library)](https://os.mbed.com/docs/development/mbed-os-api-doxy/namespacertos_1_1_kernel.html)
88

9-
## get_ms_count() example
9+
## Kernel::Clock example
1010

11-
The function `get_ms_count()` can be used to read the current RTOS kernel millisecond tick count. The below code snippet demonstrates use of the `get_ms_count()` function to calculate the elapsed time:
11+
The nested class `Clock` can be used to read the current RTOS kernel millisecond tick count as a C++11 Chrono time point. The below code snippet demonstrates use of `Kernel::Clock` to calculate the elapsed time:
1212

1313
[![View code](https://www.mbed.com/embed/?url=https://github.com/ARMmbed/mbed-os-examples-docs_only/blob/master/APIs_RTOS/Kernel_get_ms_count)](https://github.com/ARMmbed/mbed-os-examples-docs_only/blob/master/APIs_RTOS/Kernel_get_ms_count/main.cpp)
1414

docs/contributing/guidelines/style.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,10 @@ Occasionally, namespaces are used to act as-if "static singleton" objects. One e
152152
Below is an example of typical namespace use in a source file:
153153

154154
```
155-
using namespace rtos;
155+
using namespace rtos; // for ThisThread
156+
using namespace std::chrono_literals; // for 1s
156157
157-
ThisThread::sleep_for(1000);
158+
ThisThread::sleep_for(1s);
158159
159160
```
160161

0 commit comments

Comments
 (0)