Jump to: navigation, search

Table of Contents >> Programmer's Reference

#include <trsocket.h>

int tfKernelGetPreciseTime (ttUser64BitPtr valPtr);

Function Description

This is a RTOS specific function that the user provides, if needed. It is called from some Treck protocols (e.g. SNTP) when there is a need for precise interval measurement. It is only called if the following configuration macro is defined in your trsystem.h:

The source is intended to be a high frequency counter/timer. The value need not map to UTC time.

The *valPtr value returned must be an incrementing counter value and must seamlessly wraparound at 2**64 to avoid a time gap when an interval measurement spans the wraparound boundary.

If the RTOS or hardware provides less than 64 bits, shift the value left so that the most significant bit is bit 63. Otherwise, there will be a time gap.

If wraparound is not 2's complement (e.g. has sequence 997, 998, 999, 0, 1, ...), there will be a time gap. Multiply the value by 2**64 / M, where M is the modulus of the counter (e.g. 1000).


  • valPtr
    A pointer to store a 64-bit high frequency counter value.


    Failed to obtain the system time.

Table of Contents >> Programmer's Reference