Jump to main content

##

# 1.2.11.4.14 SYS_TIME_CountToMS Function

## C

    uint32_t SYS_TIME_CountToMS ( uint32_t count )

## Summary

Converts a counter value to time interval in milliseconds.

## Description

This function converts a counter value to time interval in milliseconds, based on the hardware timer frequency as configured and as reported by SYS_TIME_FrequencyGet.

## Precondition

The SYS_TIME_Initialize function should have been called before calling this function.

## Parameters

Param | Description
--- | ---
count | Counter value to be converted to an equivalent value in milliseconds.

## Returns

Number of milliseconds represented by the given counter value.

## Example

Given a previously captured uint32_t counter value called "timestamp" captured using the SYS_TIME_CounterGet function, the following example will calculate number of milliseconds elapsed since timestamp was captured.

    uint32_t count = SYS_TIME_CounterGet() - timestamp;
    uint32_t ms = SYS_TIME_CountToMS(count);

## Remarks

None.