Time management provides all time-related services for applications based on the system clock. The system clock is generated by the interrupts triggered by the output pulse of a timer or counter. The system clock is generally defined as an integer or a long integer. The period of an output pulse is a "clock tick". The system clock is also called time scale or tick. The duration of a tick can be configured statically. People use second or millisecond as the time unit, while the operating system uses tick. When operations such as suspending a task or delaying a task are performed, the time management module converts time between ticks and seconds or milliseconds.
...
...
@@ -19,11 +19,11 @@ The mapping between ticks and seconds can be configured.
The OpenHarmony time management module provides time conversion, statistics, and delay functions to meet users' time requirements.
## Development Guidelines<a name="section430981720522"></a>
## Development Guidelines
The time management module provides APIs to implement conversion between the system running time, ticks, and seconds/milliseconds.
### Available APIs<a name="section1040142705214"></a>
### Available APIs
The following table describes APIs available for the OpenHarmony LiteOS-A time management. For more details about the APIs, see the API reference.
...
...
@@ -65,22 +65,23 @@ The following table describes APIs available for the OpenHarmony LiteOS-A time m
</tbody>
</table>
### How to Develop<a name="section1381224710522"></a>
>- The system tick count can be obtained only after the system clock is enabled.
>- The time management module depends on **OS\_SYS\_CLOCK** and **LOSCFG\_BASE\_CORE\_TICK\_PER\_SECOND** in **los\_config.h**.
>- The number of system ticks is not counted when the interrupt feature is disabled. Therefore, the number of ticks cannot be used as the accurate time.
### Development Example<a name="section1344610245416"></a>
### Development Example
Prerequisites:
**Prerequisites**<br>
The following parameters are configured:
-**LOSCFG\_BASE\_CORE\_TICK\_PER\_SECOND**, that is, the number of ticks per second in the system, is configured.
-**OS\_SYS\_CLOCK**, that is, system clock \(in Hz\), is configured.
-**LOSCFG\_BASE\_CORE\_TICK\_PER\_SECOND**: number of ticks per second in the system. The value range is (0, 1000].