Corrections to the NTP client from Manuel Stuehn
This commit is contained in:
parent
e2153dd2b7
commit
638fad2d36
@ -882,4 +882,6 @@
|
|||||||
changes that are part of the overal resolv->dns renaming (2014-4-11).
|
changes that are part of the overal resolv->dns renaming (2014-4-11).
|
||||||
* apps/netutils/dnsclient: Break the one big monolithic file into
|
* apps/netutils/dnsclient: Break the one big monolithic file into
|
||||||
three smaller files (2014-4-11).
|
three smaller files (2014-4-11).
|
||||||
|
* apps/netutils/ntpclient/ntpclient.c: Corrections to the NTP client
|
||||||
|
from Manuel Stuehn (2014-4-12).
|
||||||
|
|
||||||
|
@ -114,10 +114,10 @@ static inline uint32_t ntpc_getuint32(FAR uint8_t *ptr)
|
|||||||
{
|
{
|
||||||
/* Network order is big-endian; host order is irrelevant */
|
/* Network order is big-endian; host order is irrelevant */
|
||||||
|
|
||||||
return (uint32_t)ptr[0] | /* LS byte appears first in data stream */
|
return (uint32_t)ptr[3] | /* MS byte appears first in data stream */
|
||||||
((uint32_t)ptr[1] << 8) |
|
((uint32_t)ptr[2] << 8) |
|
||||||
((uint32_t)ptr[2] << 16) |
|
((uint32_t)ptr[1] << 16) |
|
||||||
((uint32_t)ptr[3] << 24);
|
((uint32_t)ptr[0] << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -347,7 +347,7 @@ static int ntpc_daemon(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
sched_lock();
|
sched_lock();
|
||||||
while (g_ntpc_daemon.state == NTP_STOP_REQUESTED)
|
while (g_ntpc_daemon.state != NTP_STOP_REQUESTED)
|
||||||
{
|
{
|
||||||
/* Format the transmit datagram */
|
/* Format the transmit datagram */
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ static int ntpc_daemon(int argc, char **argv)
|
|||||||
* datagram.
|
* datagram.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (nbytes >= NTP_DATAGRAM_MINSIZE)
|
if (nbytes >= (ssize_t)NTP_DATAGRAM_MINSIZE)
|
||||||
{
|
{
|
||||||
svdbg("Setting time\n");
|
svdbg("Setting time\n");
|
||||||
ntpc_settime(recv.recvtimestamp);
|
ntpc_settime(recv.recvtimestamp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user