# Alarm

# Alarm

This module includes the platform abstraction for the alarm service.

## Summary

| ### Functions ||
|---|---|
| `https://openthread.io/reference/group/plat-alarm#group__plat-alarm_1ga0830dc0974cf4306f63ca065c63d920b(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `void` Signal that the alarm has fired. |
| `https://openthread.io/reference/group/plat-alarm#group__plat-alarm_1ga5116a82b3423566dccf1df4771d05341(void)` | `uint32_t` Get the current time. |
| `https://openthread.io/reference/group/plat-alarm#group__plat-alarm_1ga4f2899b10bc1b3775c61ee0991ff1a1d(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint32_t aT0, uint32_t aDt)` | `void` Set the alarm to fire at `aDt` microseconds after `aT0`. |
| `https://openthread.io/reference/group/plat-alarm#group__plat-alarm_1ga7b13b8634c4c9fff2440f8ae6ec94375(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `void` Stop the alarm. |
| `https://openthread.io/reference/group/plat-alarm#group__plat-alarm_1ga82ef729aca5865bf448dcaba69e46258(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `void` Signal that the alarm has fired. |
| `https://openthread.io/reference/group/plat-alarm#group__plat-alarm_1gaf56bf9d00fe152b113a6fcff62b57922(void)` | `uint32_t` Get the current time. |
| `https://openthread.io/reference/group/plat-alarm#group__plat-alarm_1ga72e7235954bb183e40ba21d9493c8259(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint32_t aT0, uint32_t aDt)` | `void` Set the alarm to fire at `aDt` milliseconds after `aT0`. |
| `https://openthread.io/reference/group/plat-alarm#group__plat-alarm_1ga907142fc67493286549854105ea2bf17(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `void` Stop the alarm. |
| `https://openthread.io/reference/group/plat-alarm#group__plat-alarm_1gacf1f0acac2fd94a3434b64dd09bf49e9(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `void` Signal diagnostics module that the alarm has fired. |

## Functions

### otPlatAlarmMicroFired

```
void otPlatAlarmMicroFired(
  otInstance *aInstance
)
```
Signal that the alarm has fired.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance structure. | |

### otPlatAlarmMicroGetNow

```
uint32_t otPlatAlarmMicroGetNow(
  void
)
```
Get the current time.

The current time MUST represent a free-running timer. When maintaining current time, the time value MUST utilize the entire range \[0, 2\^32-1\] and MUST NOT wrap before 2\^32.

<br />

| Details ||
|---|---|
| **Returns** | The current time in microseconds. |

### otPlatAlarmMicroStartAt

```
void otPlatAlarmMicroStartAt(
  otInstance *aInstance,
  uint32_t aT0,
  uint32_t aDt
)
```
Set the alarm to fire at `aDt` microseconds after `aT0`.

For `aT0`, the platform MUST support all values in \[0, 2\^32-1\]. For `aDt`, the platform MUST support all values in \[0, 2\^31-1\].

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance structure. | | `[in] aT0` | The reference time. | | `[in] aDt` | The time delay in microseconds from `aT0`. | |

### otPlatAlarmMicroStop

```
void otPlatAlarmMicroStop(
  otInstance *aInstance
)
```
Stop the alarm.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance structure. | |

### otPlatAlarmMilliFired

```
void otPlatAlarmMilliFired(
  otInstance *aInstance
)
```
Signal that the alarm has fired.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance structure. | |

### otPlatAlarmMilliGetNow

```
uint32_t otPlatAlarmMilliGetNow(
  void
)
```
Get the current time.

The current time MUST represent a free-running timer. When maintaining current time, the time value MUST utilize the entire range \[0, 2\^32-1\] and MUST NOT wrap before 2\^32.

<br />

| Details ||
|---|---|
| **Returns** | The current time in milliseconds. |

### otPlatAlarmMilliStartAt

```
void otPlatAlarmMilliStartAt(
  otInstance *aInstance,
  uint32_t aT0,
  uint32_t aDt
)
```
Set the alarm to fire at `aDt` milliseconds after `aT0`.

For `aT0` the platform MUST support all values in \[0, 2\^32-1\]. For `aDt`, the platform MUST support all values in \[0, 2\^31-1\].

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance structure. | | `[in] aT0` | The reference time. | | `[in] aDt` | The time delay in milliseconds from `aT0`. | |

### otPlatAlarmMilliStop

```
void otPlatAlarmMilliStop(
  otInstance *aInstance
)
```
Stop the alarm.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance structure. | |

### otPlatDiagAlarmFired

```
void otPlatDiagAlarmFired(
  otInstance *aInstance
)
```
Signal diagnostics module that the alarm has fired.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance structure. | |

## Resources

OpenThread API Reference topics originate from the source code, available
on [GitHub](https://github.com/openthread/openthread/tree/main/include/openthread).
For more information, or to contribute to our documentation, refer to
[Resources](https://openthread.io/resources).