ntpclient: change sinfo to ninfo

Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
This commit is contained in:
Juha Niskanen 2021-01-14 16:42:06 +02:00 committed by Xiang Xiao
parent 95a06846bc
commit 35535655c5
2 changed files with 10 additions and 8 deletions

View File

@ -45,6 +45,7 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Configuration ************************************************************/ /* Configuration ************************************************************/
#ifndef CONFIG_NETUTILS_NTPCLIENT_SERVERIP #ifndef CONFIG_NETUTILS_NTPCLIENT_SERVERIP
@ -90,6 +91,7 @@ extern "C"
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: ntpc_start * Name: ntpc_start
* *

View File

@ -79,7 +79,7 @@
* since 1970 * since 1970
*/ */
#define NTP2UNIX_TRANLSLATION 2208988800u #define NTP2UNIX_TRANSLATION 2208988800u
#define NTP_VERSION 3 #define NTP_VERSION 3
/**************************************************************************** /****************************************************************************
@ -138,7 +138,7 @@ static struct ntpc_daemon_s g_ntpc_daemon =
* *
****************************************************************************/ ****************************************************************************/
static inline uint32_t ntpc_getuint32(FAR uint8_t *ptr) static inline uint32_t ntpc_getuint32(FAR const uint8_t *ptr)
{ {
/* Network order is big-endian; host order is irrelevant */ /* Network order is big-endian; host order is irrelevant */
@ -190,9 +190,9 @@ static void ntpc_settime(FAR uint8_t *timestamp)
/* Translate seconds to account for the difference in the origin time */ /* Translate seconds to account for the difference in the origin time */
if (seconds > NTP2UNIX_TRANLSLATION) if (seconds > NTP2UNIX_TRANSLATION)
{ {
seconds -= NTP2UNIX_TRANLSLATION; seconds -= NTP2UNIX_TRANSLATION;
} }
/* Conversion of the fractional part to nanoseconds: /* Conversion of the fractional part to nanoseconds:
@ -296,7 +296,7 @@ static void ntpc_settime(FAR uint8_t *timestamp)
tp.tv_nsec = nsec; tp.tv_nsec = nsec;
clock_settime(CLOCK_REALTIME, &tp); clock_settime(CLOCK_REALTIME, &tp);
sinfo("Set time to %ju seconds\n", (intmax_t)tp.tv_sec); ninfo("Set time to %ju seconds\n", (intmax_t)tp.tv_sec);
} }
/**************************************************************************** /****************************************************************************
@ -422,7 +422,7 @@ static int ntpc_daemon(int argc, char **argv)
memset(&pkt, 0, sizeof(pkt)); memset(&pkt, 0, sizeof(pkt));
pkt.lvm = MKLVM(0, NTP_VERSION, 3); pkt.lvm = MKLVM(0, NTP_VERSION, 3);
sinfo("Sending a NTP packet\n"); ninfo("Sending a NTP packet\n");
ret = sendto(sd, &pkt, sizeof(struct ntp_datagram_s), ret = sendto(sd, &pkt, sizeof(struct ntp_datagram_s),
0, (FAR struct sockaddr *)&server, 0, (FAR struct sockaddr *)&server,
@ -464,7 +464,7 @@ static int ntpc_daemon(int argc, char **argv)
if (nbytes >= (ssize_t)NTP_DATAGRAM_MINSIZE) if (nbytes >= (ssize_t)NTP_DATAGRAM_MINSIZE)
{ {
sinfo("Setting time\n"); ninfo("Setting time\n");
ntpc_settime(pkt.recvtimestamp); ntpc_settime(pkt.recvtimestamp);
retry = 0; retry = 0;
} }
@ -503,7 +503,7 @@ static int ntpc_daemon(int argc, char **argv)
if (g_ntpc_daemon.state == NTP_RUNNING) if (g_ntpc_daemon.state == NTP_RUNNING)
{ {
sinfo("Waiting for %d seconds\n", ninfo("Waiting for %d seconds\n",
CONFIG_NETUTILS_NTPCLIENT_POLLDELAYSEC); CONFIG_NETUTILS_NTPCLIENT_POLLDELAYSEC);
sleep(CONFIG_NETUTILS_NTPCLIENT_POLLDELAYSEC); sleep(CONFIG_NETUTILS_NTPCLIENT_POLLDELAYSEC);