<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>MQX Software SolutionsのトピックBug in SNTP_oneshot()</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-in-SNTP-oneshot/m-p/263531#M7874</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think there is a bug in SNTP_oneshot()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When call to NTP server is unsuccessful, function call set however the system time with a zero value, clearing previous data.&lt;/P&gt;&lt;P&gt;We have then a 0 in system time. What about ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Luc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Feb 2014 08:45:25 GMT</pubDate>
    <dc:creator>lucky06200</dc:creator>
    <dc:date>2014-02-27T08:45:25Z</dc:date>
    <item>
      <title>Bug in SNTP_oneshot()</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-in-SNTP-oneshot/m-p/263531#M7874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think there is a bug in SNTP_oneshot()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When call to NTP server is unsuccessful, function call set however the system time with a zero value, clearing previous data.&lt;/P&gt;&lt;P&gt;We have then a 0 in system time. What about ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Luc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 08:45:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-in-SNTP-oneshot/m-p/263531#M7874</guid>
      <dc:creator>lucky06200</dc:creator>
      <dc:date>2014-02-27T08:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in SNTP_oneshot()</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-in-SNTP-oneshot/m-p/263532#M7875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Luc:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to MQX_RTCS_User_Guide.pdf, SNTP_oneshot function sends an SNTP packet and waits for a reply. If a reply is received before timeout elapse, the time is set. If no reply is received within the specified time,RTCSERR_TIMEOUT is returned. The local time is set in UTC (coordinated universal time)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can see the code in function SNTP_timed_send_recv,&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /* Send packet */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; error = sendto(sock, (char_ptr)&amp;amp;header, sizeof(SNTP_HEADER), 0, (sockaddr *)&amp;amp;addr,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sizeof(sockaddr_in));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /* Get reply only if request was sent */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if (error != sizeof(SNTP_HEADER)) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return RTCS_geterror(sock);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; } /* Endif */&lt;/P&gt;&lt;P&gt;.......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I guess maybe your NTP server returned a zero value, but not sure, need further information to analyze.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Daniel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2014 05:48:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-in-SNTP-oneshot/m-p/263532#M7875</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2014-03-04T05:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in SNTP_oneshot()</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-in-SNTP-oneshot/m-p/263533#M7876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Luc,&lt;BR /&gt;To add to Daniel's good comments I did an experiment using TWR-K60F120M tower kit.&lt;BR /&gt;I started with the C:\Freescale\Freescale_MQX_4_0_2_GA\rtcs\examples\shell\cw10gcc\rtcs_shell_twrk60f120m example using CW10.5.&lt;BR /&gt;In the demo_cmd.c file I added the following (the line with "//DES test" comment):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { "ipconfig",&amp;nbsp; Shell_ipconfig },&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { "oneshot", Shell_SNTP_oneshot },&amp;nbsp;&amp;nbsp; //DES test&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the shell RTOS component I added the following to the sh_rtcs.h header:&lt;BR /&gt;extern int_32 Shell_iwconfig(int_32 argc, char_ptr argv[] );&lt;BR /&gt;extern int_32 Shell_SNTP_oneshot(int_32 argc, char_ptr argv[] ); //DES test&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the shell RTOS component I copied and pasted the sh_tftp.c and renamed it "sh_oneshot.c".&amp;nbsp; I then added the file into the shell component (drag-n-drop using Windows Explorer) "Shell Source--&amp;gt;rtcs" folder (i.e. it gets added to the project for compiling).&amp;nbsp; I've attached this file to the post as it is the only file I had to generate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Compile the shell RTOS component and then the rtcs_shell application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I used the NIST Internet Time Server ( &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://tf.nist.gov/tf-cgi/servers.cgi"&gt;http://tf.nist.gov/tf-cgi/servers.cgi&lt;/A&gt;&lt;SPAN&gt; ) to find a NTP Server IP Address to use below.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;My Terminal prompt output is:&lt;/P&gt;&lt;P&gt;shell&amp;gt; &lt;BR /&gt;shell&amp;gt; help oneshot&lt;BR /&gt;Usage: oneshot&amp;nbsp; &amp;lt;host&amp;gt; &amp;lt;timeout_ms&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;host&amp;gt;&amp;nbsp;&amp;nbsp; = host ip address or name&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;timeout_ms&amp;gt;&amp;nbsp;&amp;nbsp; = timeout delay in milliseconds&lt;BR /&gt;shell&amp;gt; &lt;BR /&gt;shell&amp;gt; oneshot 64.90.182.55 6000&lt;BR /&gt;Connecting to 64.90.182.55 [64.90.182.55]: &amp;lt;-- NTP SERVER DOWN :-(&lt;BR /&gt;Connection failed, error 0x1103&lt;BR /&gt;Connection closed&lt;BR /&gt;shell&amp;gt; &lt;BR /&gt;shell&amp;gt; oneshot 129.6.15.30 8000&lt;BR /&gt;Connecting to 129.6.15.30 [129.6.15.30]: &amp;lt;-- NTP SERVER UP :-)&lt;BR /&gt;Connection closed&lt;BR /&gt;shell&amp;gt; &lt;BR /&gt;shell&amp;gt; help&lt;BR /&gt;Available commands:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; gethbn &amp;lt;host&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; help [&amp;lt;command&amp;gt;]&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ipconfig [&amp;lt;device&amp;gt;] [&amp;lt;command&amp;gt;]&lt;BR /&gt;&amp;nbsp;&amp;nbsp; oneshot &amp;lt;host&amp;gt; &amp;lt;timeout_ms&amp;gt;&amp;nbsp; &amp;lt;--NEW COMMAND in the help list&lt;BR /&gt;shell&amp;gt; &lt;BR /&gt;shell&amp;gt; dir&lt;BR /&gt;Error, directory does not exist.&lt;BR /&gt;shell&amp;gt; &lt;BR /&gt;shell&amp;gt; format a: david&lt;/P&gt;&lt;P&gt;Formating...&lt;BR /&gt;Done. Volume name is DAVID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;Free disk space: 11776 bytes&lt;BR /&gt;shell&amp;gt; &lt;BR /&gt;shell&amp;gt; write bob 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;shell&amp;gt; &lt;BR /&gt;shell&amp;gt; dir&lt;BR /&gt;DAVID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 00-00-1980 00:00:00&amp;nbsp;&amp;nbsp;&amp;nbsp; V&amp;nbsp;&amp;nbsp; DAVID &amp;lt;-- NOT SURE WHY NOT PROPER DATE and TIME&lt;BR /&gt;BOB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 03-04-2014 19:19:20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A BOB &amp;lt;-- PROPER DATE and TIME !&lt;BR /&gt;shell&amp;gt; &lt;BR /&gt;shell&amp;gt; &lt;BR /&gt;shell&amp;gt; &lt;BR /&gt;shell&amp;gt; &lt;BR /&gt;shell&amp;gt; gethbn time-c.nist.gov&amp;nbsp; &amp;lt;--IF YOU KNOW SERVERNAME AND WANT IP ADDRESS&lt;BR /&gt;time-c.nist.gov...129.6.15.30&lt;BR /&gt;shell&amp;gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2014 20:15:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-in-SNTP-oneshot/m-p/263533#M7876</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2014-03-04T20:15:23Z</dc:date>
    </item>
  </channel>
</rss>

