You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/01/14 17:08:09 UTC

[incubator-nuttx-apps] branch master updated: ntpclient: change sinfo to ninfo

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 3553565  ntpclient: change sinfo to ninfo
3553565 is described below

commit 35535655c57578d7fdd4f9d376dfbefc504d975a
Author: Juha Niskanen <ju...@haltian.com>
AuthorDate: Thu Jan 14 16:42:06 2021 +0200

    ntpclient: change sinfo to ninfo
    
    Signed-off-by: Juha Niskanen <ju...@haltian.com>
---
 include/netutils/ntpclient.h   |  2 ++
 netutils/ntpclient/ntpclient.c | 16 ++++++++--------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/include/netutils/ntpclient.h b/include/netutils/ntpclient.h
index c4d7850..8d37802 100644
--- a/include/netutils/ntpclient.h
+++ b/include/netutils/ntpclient.h
@@ -45,6 +45,7 @@
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
+
 /* Configuration ************************************************************/
 
 #ifndef CONFIG_NETUTILS_NTPCLIENT_SERVERIP
@@ -90,6 +91,7 @@ extern "C"
 /****************************************************************************
  * Public Function Prototypes
  ****************************************************************************/
+
 /****************************************************************************
  * Name: ntpc_start
  *
diff --git a/netutils/ntpclient/ntpclient.c b/netutils/ntpclient/ntpclient.c
index 5bda91c..528d3b3 100644
--- a/netutils/ntpclient/ntpclient.c
+++ b/netutils/ntpclient/ntpclient.c
@@ -79,7 +79,7 @@
  * since 1970
  */
 
-#define NTP2UNIX_TRANLSLATION 2208988800u
+#define NTP2UNIX_TRANSLATION 2208988800u
 #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 */
 
@@ -190,9 +190,9 @@ static void ntpc_settime(FAR uint8_t *timestamp)
 
   /* 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:
@@ -296,7 +296,7 @@ static void ntpc_settime(FAR uint8_t *timestamp)
   tp.tv_nsec = nsec;
   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));
       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),
                    0, (FAR struct sockaddr *)&server,
@@ -464,7 +464,7 @@ static int ntpc_daemon(int argc, char **argv)
 
       if (nbytes >= (ssize_t)NTP_DATAGRAM_MINSIZE)
         {
-          sinfo("Setting time\n");
+          ninfo("Setting time\n");
           ntpc_settime(pkt.recvtimestamp);
           retry = 0;
         }
@@ -503,7 +503,7 @@ static int ntpc_daemon(int argc, char **argv)
 
       if (g_ntpc_daemon.state == NTP_RUNNING)
         {
-          sinfo("Waiting for %d seconds\n",
+          ninfo("Waiting for %d seconds\n",
                 CONFIG_NETUTILS_NTPCLIENT_POLLDELAYSEC);
 
           sleep(CONFIG_NETUTILS_NTPCLIENT_POLLDELAYSEC);