Jump to main content

##

# 1.2.11.4.11 SYS_TIME_Counter64Get Function

## C

    uint64_t SYS_TIME_Counter64Get ( void )

## Summary

Get the common 64-bit system counter value.

## Description

Returns the current "live" value of the common 64-bit system counter.

## Precondition

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

## Parameters

None

## Returns

The current "live" value of the common 64-bit system counter.

## Example

    uint64_t timeStamp1;
    uint64_t timeStamp2;
    uint64_t timeDiffMs;

    // Take first time stamp
    timeStamp1 = SYS_TIME_Counter64Get();

    //Perform some tasks....

    // Take second time stamp
    timeStamp2 = SYS_TIME_Counter64Get();

    //Calculate the time difference.
    timeDiffMs = timeStamp2 - timeStamp1;
    timeDiffMs = (uint64_t)(((double)timeDiffMs/SYS_TIME_FrequencyGet())*1000.0);

## Remarks

The value returned may be stale as soon as it is provided, as the timer is live and running at full frequency resolution (as configured and as reported by the SYS_TIME_FrequencyGet function). If additional accuracy is required, use a hardware timer instance.