Files | Data Structures | Typedefs | Functions

This module handles the SNTP timestamp (from server and system). More...

+ Collaboration diagram for SNTP:

Files

file  XDK_SNTP.h
 

Data Structures

struct  SNTP_Setup_S
 Structure to represent the SNTP setup features. More...
 

Typedefs

typedef struct SNTP_Setup_S SNTP_Setup_T
 typedef to represent the SNTP setup feature. More...
 

Functions

Retcode_T SNTP_Disable (void)
 This will disable the SNTP. More...
 
Retcode_T SNTP_Enable (void)
 This will enable the SNTP. More...
 
Retcode_T SNTP_GetTimeFromServer (uint64_t *sntpTimeStamp, uint32_t timeout)
 This will request SNTP time-stamp from the SNTP server and return the same. More...
 
Retcode_T SNTP_GetTimeFromSystem (uint64_t *sntpTimeStamp, uint32_t *timeLapseInMs)
 This will provide SNTP time-stamp based on last synced SNTP server value and system time. More...
 
Retcode_T SNTP_SetTime (uint64_t sntpTimeStamp)
 This will set SNTP time-stamp for the device. More...
 
Retcode_T SNTP_Setup (SNTP_Setup_T *setup)
 This will setup the SNTP. More...
 

Detailed Description


Data Structure Documentation

struct SNTP_Setup_S

Data Fields

uint16_t ServerPort
 
const char * ServerUrl
 

Field Documentation

uint16_t ServerPort

Port number of the SNTP server

const char* ServerUrl

Pointer to the SNTP server URL

Typedef Documentation

typedef struct SNTP_Setup_S SNTP_Setup_T

Function Documentation

Retcode_T SNTP_Disable ( void  )
Returns
RETCODE_OK on success, or an error code otherwise for XDK_UTILITY_SERVALPAL enabled. RETCODE_NOT_SUPPORTED for XDK_UTILITY_SERVALPAL disabled.
Note

+ Here is the caller graph for this function:

Retcode_T SNTP_Enable ( void  )
Returns
RETCODE_OK on success, or an error code otherwise.
Note

+ Here is the caller graph for this function:

Retcode_T SNTP_GetTimeFromServer ( uint64_t *  sntpTimeStamp,
uint32_t  timeout 
)
Parameters
in/out]sntpTimeStamp SNTP time-stamp in UNIX format. 0 if server response was 0. Interface user must provide data memory.
[in]timeoutTimeout for response from the server.
Returns
RETCODE_OK on success, or an error code otherwise.
Note

+ Here is the caller graph for this function:

Retcode_T SNTP_GetTimeFromSystem ( uint64_t *  sntpTimeStamp,
uint32_t *  timeLapseInMs 
)
Parameters
in/out]sntpTimeStamp Pointer to SNTP time-stamp in UNIX format. In seconds. 0 if server response failed. Interface user must provide data memory.
in/out]timeLapseInMs Pointer to time lapsed in millisecond. Interface user must provide data memory.
Returns
RETCODE_OK on success, or an error code otherwise.
Note
  • SNTP_Setup and SNTP_Enable must have been successful prior.
  • SNTP_GetTimeFromSystem must have be called prior to this.
  • Accuracy is limited due to XDK's internal clock inaccuracies w.r.t real time.
  • Perform SNTP_GetTimeFromServer once in ~40 days atleast to avoid invalid time stamp since we use uint32_t system tick which will overflow otherwise.

+ Here is the caller graph for this function:

Retcode_T SNTP_SetTime ( uint64_t  sntpTimeStamp)
Parameters
[in]sntpTimeStampSNTP time-stamp in UNIX format. In seconds.
Returns
RETCODE_OK on success, or an error code otherwise.
Note

+ Here is the caller graph for this function:

Retcode_T SNTP_Setup ( SNTP_Setup_T setup)
Parameters
[in]setupPointer to the SNTP setup feature
Returns
RETCODE_OK on success, or an error code otherwise.
Note
  • If setup->UseServerUrl is enabled, then setup->ServerIpAddr is unused
  • If setup->UseServerUrl is disabled, then setup->ServerUrl is unused
  • This must be the first API to be called if SNTP feature is to be used.
  • WLAN_Setup must have been successful prior.
  • ServalPAL_Setup must have been successful prior.
  • Do not call this API more than once.

+ Here is the caller graph for this function:


This documentation file has been automatically generated on Fri Oct 4 2019 03:47:34 by doxygen 1.8.8