NTP packet

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

NTP packet

2,245件の閲覧回数
cbursk
Contributor I

Hello,

I need to come up with an implementation of an NTP packet.  I was hoping that there was already built in support for this in MQX, but so far I'm coming up empty.  I thought I saw in another thread that SNTP is supported, but I can't seem to find any info on it.

Any pointers would be appreciated.

Thanks,

0 件の賞賛
3 返答(返信)

619件の閲覧回数
PetrL
NXP Employee
NXP Employee

Hi,

 

MQX implements SNTP client. See MQX RTCS User's guide (MQXRTCSUG.pdf) chapeters 7.1.147 SNTP_oneshot() and 7.1.146 SNTP_init()..

 

Regards,

PetrL

0 件の賞賛

619件の閲覧回数
cbursk
Contributor I

Thanks for your help, its amazing how much easier this becomes when e look in the right spot.  I do have a follow up question, in the sntp.c file in the SNTP_build_header method the header is built but the timestamp that gets set is the TRANSMIT_TIMESTAMP1 & 2.  I'm confised by this, if the header is being built to be transmitted by a client, shouldn't this be setting the ORIGINATE_TIMESTAMPs?  Also I can't seem to find where who fills in the REFERENCE_TIMESTAMPs.

 

Thank you!

0 件の賞賛

619件の閲覧回数
EAI
Contributor IV

Per RFC-4330:

   Although setting the Transmit Timestamp field in the request to the
   time of day according to the client clock in NTP timestamp format is
   not necessary in a conforming client implementation, it is highly
   recommended in unicast and manycast modes.  This allows a simple
   calculation to determine the propagation delay between the server and
   client and to align the system clock generally within a few tens of
   milliseconds relative to the server.  In addition, this provides a
   simple method for verifying that the server reply is in fact a
   legitimate response to the specific client request and thereby for
   avoiding replays.  In broadcast mode, the client has no information
   to calculate the propagation delay or to determine the validity of
   the server, unless one of the NTP authentication schemes is used.

   To calculate the roundtrip delay d and system clock offset t relative
   to the server, the client sets the Transmit Timestamp field in the
   request to the time of day according to the client clock in NTP
   timestamp format.  For this purpose, the clock need not be
   synchronized.  The server copies this field to the Originate
   Timestamp in the reply and sets the Receive Timestamp and Transmit
   Timestamp fields to the time of day according to the server clock in
   NTP timestamp format.

 

0 件の賞賛