Rtnl2ReadClock

Rtnl2ReadClock reads the NIC clock time and the CPU time simultaneously (cross-timestamp) and returns all timestamps.

Syntax

Copy
BOOL Rtnl2ReadClock(
    [in]     RTNL2_HCLOCK Clock, 
    [out]    RTNL2_READ_CLOCK_RESULT *pResult, 
    [in]     ULONG ResultStructSize
);

Parameters

[in] Clock

A handle to a clock object (see RTNL2_HCLOCK).

[out] pResult

An RTNL2_READ_CLOCK_RESULT structure containing a collection if timestamps retrieved during the cross-timestamp read operation.

[in] ResultStructSize

The size of the RTNL2_READ_CLOCK_RESULT structure. The caller must set this parameter to sizeof(RTNL2_READ_CLOCK_RESULT).

Return Value

If the function succeeds, it returns TRUE. If the function fails, it returns FALSE. Call GetLastError to obtain an error code.

Possible error codes:

Error code Meaning

ERROR_NOT_READY

The calling process has not called Rtnl2Init.

ERROR_INVALID_PARAMETER

One of the following conditions occurred:

  • The supplied Clock handle is invalid.
  • The pResult value is NULL.

ERROR_DEVICE_FEATURE_NOT_SUPPORTED

The hardware doesn’t support reading the NIC clock counter.

RTNL2_ERROR_SERIALIZED_COMMAND_TIMEOUT

The NL2 process didn’t reply within an acceptable delay.

RTNL2_ERROR_NO_MORE_COMMUNICATION

Unable to communicate with the NL2 process. This might be because the NL2 process is no longer running, or because an application process thread was terminated during a previous call to an NL2 API function.

Remarks

If the handle to the clock was opened with the RTNL2_CLOCK_FLAG_PTM flag, the NL2 first tries to perform the cross-timestamping operation in hardware, using PTM. If that fails, it falls back to the software method. If the handle to the clock was opened without the RTNL2_CLOCK_FLAG_PTM flag, the NL2 uses the software method. At the end of the operation, the NL2 populates the RTNL2_READ_CLOCK_RESULT.Flags field to indicate which method was used.

The NL2 also indicates in the RTNL2_READ_CLOCK_RESULT.Flags field whether the clock was modified by another handle since it was last read. This allows the application to reinitialize its smoothing algorithm in case the modification was done asynchronously by another application.

Characteristics

Real-time

Deterministic

No

Shutdown-safe

No

Local memory usage

Process

External MSpace usage

Internal MSpace usage

System

No

No

NL2 process

No

No

Calling process

No

No

Windows contiguous memory usage

Usage

No

Requirements

Minimum supported version Header Library

wRTOS 1.0 SDK

Rtnl2Api.h

Rtnl2Api.lib

See Also: