コード例 #1
0
/* 
 * ===  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  ----- */
コード例 #2
0
ファイル: ntpmgmt.c プロジェクト: andrewrothstein/ipxe
/**
 * 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;
}
コード例 #3
0
ファイル: ntp.c プロジェクト: HoraceWeebler/connman
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;
}
コード例 #4
0
ファイル: agent_core.c プロジェクト: NL6621/Yeelink
/* 
 * ===  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  ----- */