diag: trace RTC synchronization and WSS clock state
This commit is contained in:
@@ -77,6 +77,7 @@ static const char rcsid[] = "$OpenBSD: rdate.c,v 1.22 2004/02/18 20:10:53 jmc Ex
|
||||
#endif
|
||||
#include "utltime.h"
|
||||
#include "quec_cust_feature.h"
|
||||
#include "../../../ql-config/config/talkingq_time_diag.h"
|
||||
/* there are systems without libutil; for portability */
|
||||
#ifdef HAVE_UTIL_H
|
||||
#include <util.h>
|
||||
@@ -204,6 +205,11 @@ int GetNTPStatus(void)
|
||||
return NTP_SYNC_SUCCESS;
|
||||
}
|
||||
|
||||
int talkingq_ntp_diag_ready(void)
|
||||
{
|
||||
return NtpFlagRef != NULL && NTPTaskRef != NULL;
|
||||
}
|
||||
|
||||
static unsigned int ntp_retry_timer[] = {
|
||||
(1 * 1000 / 5), /*2 sec*/
|
||||
(10 * 1000 / 5), /*10 sec*/
|
||||
@@ -278,11 +284,14 @@ extern char *get_ntp_server_ip(void);
|
||||
while(try_times > 0 && count < 8)
|
||||
{
|
||||
--try_times;
|
||||
printf("[TIME-DIAG] ntp_request attempt=%d server=%.31s\r\n",
|
||||
3 - try_times, strlen(hname) > 0 ? hname : hname_default);
|
||||
if(strlen(hname) > 0)
|
||||
ret = ntp_client(hname, family, &new, &adjust, corrleaps);
|
||||
else
|
||||
ret = ntp_client(hname_default, family, &new, &adjust, corrleaps);
|
||||
|
||||
printf("[TIME-DIAG] ntp_result attempt=%d rc=%d\r\n", 3 - try_times, ret);
|
||||
if(ret != 0)
|
||||
{
|
||||
continue;
|
||||
@@ -297,6 +306,7 @@ extern char *get_ntp_server_ip(void);
|
||||
if (new.tv_sec > 60 * 60 * 24 * 365)
|
||||
{
|
||||
SaveNTPParameters(ltm);
|
||||
printf("[TIME-DIAG] ntp_rtc_written epoch=%ld\r\n", (long)tim);
|
||||
break;
|
||||
}
|
||||
OSATaskSleep(200);
|
||||
@@ -311,6 +321,7 @@ extern char *get_ntp_server_ip(void);
|
||||
|
||||
SetNTPStatus(2);//failed
|
||||
}
|
||||
talkingq_time_diag_trace("ntp-finished");
|
||||
|
||||
}
|
||||
|
||||
@@ -325,12 +336,14 @@ void NTP_Init_Internal(void)
|
||||
str = psm_get_wrapper("Debug", NULL, "debug_ntp_disable");
|
||||
if (str && strcmp(str, "1") == 0)
|
||||
{
|
||||
printf("[TIME-DIAG] ntp_init skipped debug_ntp_disable=1\r\n");
|
||||
free(str);
|
||||
return;
|
||||
}
|
||||
if (str)
|
||||
free(str);
|
||||
|
||||
printf("[TIME-DIAG] ntp_init debug_ntp_disable=0\r\n");
|
||||
/* Ntp Flag initialize. */
|
||||
status = OSAFlagCreate(&NtpFlagRef);
|
||||
ASSERT(status == OS_SUCCESS);
|
||||
|
||||
Reference in New Issue
Block a user