/* 
 * ===  FUNCTION  ======================================================================
 *         Name:  RTCThread
 *  Description:  Get real time from network 
 *         Note:
 * =====================================================================================
 */
void NTPThread(void *arg)
{
	printf("Create NTP request thread success.\n");
	while(1)
	{
    	start_ntp();
		OSTimeDly(100 * 60 * 60 * 24);
	} 
}		/* -----  end of function RTCThread  ----- */
Exemple #2
0
/**
 * Get time and date via NTP
 *
 * @v hostname		Hostname
 * @ret rc		Return status code
 */
int ntp ( const char *hostname ) {
	int rc;

	/* Start NTP client */
	if ( ( rc = start_ntp ( &monojob, hostname ) ) != 0 )
		return rc;

	/* Wait for NTP to complete */
	if ( ( rc = monojob_wait ( NULL, 0 ) ) != 0 )
		return rc;

	return 0;
}
Exemple #3
0
int __connman_ntp_start(char *server)
{
	DBG("%s", server);

	if (!server)
		return -EINVAL;

	if (timeserver)
		g_free(timeserver);

	timeserver = g_strdup(server);

	start_ntp(timeserver);

	return 0;
}
Exemple #4
0
/* 
 * ===  FUNCTION  ======================================================================
 *         Name:  OtherTaskThread
 *  Description:  Finish user's private task, like NTP, OTA 
 *         Note:
 * =====================================================================================
 */
void OtherTaskThread(void *arg)
{
	int count = 0; 
	int ntp_ret = 0;
	log_info("Create Other Task thread success.\n");

	while (1) 
	{
		if ((count < 5) && (ntp_ret > 0)) 
		{
			ntp_ret = start_ntp();
			count++;
		}
		else 
		{
			/* When NTP setup finish, Add OTA functionality here. */

			OSTimeDly(1000);
		}		
	}    
}		/* -----  end of function RTCThread  ----- */