TCPIP_SNTP_TimeGet Function

C

TCPIP_SNTP_RESULT TCPIP_SNTP_TimeGet(
    uint32_t* pUTCSeconds, 
    uint32_t* pMs
);

Description

This function obtains the current time as reported by the SNTP module. Use this value for absolute time stamping. The value returned is (by default) in UTC format: the number of seconds since 01-Jan-1970 00:00:00. This function also returns the current millisecond obtained from a NTP server.

Preconditions

The TCP/IP Stack should have been initialized.

Parameters

ParametersDescription
pUTCSecondsPointer to store the current UTC seconds. Could be NULL if the UTC time is not needed.
pMsPointer to store the current millisecond.

Returns

  • SNTP_RES_OK - If the call succeeded and the values are accurate.

  • SNTP_RES_TSTAMP_STALE error code - If there is no recent timestamp.

  • SNTP_RES_TSTAMP_ERROR error code - If there is no available timestamp.

Remarks

When SNTP_RES_TSTAMP_ERROR is returned, the time values are meaningless and should not be used.