<?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>topic Re: MQX &amp;quot;struct tm&amp;quot; not standard C in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-quot-struct-tm-quot-not-standard-C/m-p/650958#M17187</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know there is conversion functions to convert between broken-down time format and unix format and that's exactly the problem. I have a RTC which I have to set. I get the command and time to set from a telnet connection from a PC. When I fill the broken-down time structure, if I respect the standard C of struct tm, the date saved is not what I would expect. It is one day later. I have to substract 1 to tm_mday to be compatible with MQX struct tm. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know it's not a big deal and I can live with that. But why didn't MQX respect the C standard ? Why is MQX implementing time.c file when it is already provided by the standard C librairies of all C compilers?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Hugo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Oct 2016 08:40:47 GMT</pubDate>
    <dc:creator>hbouch</dc:creator>
    <dc:date>2016-10-20T08:40:47Z</dc:date>
    <item>
      <title>MQX "struct tm" not standard C</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-quot-struct-tm-quot-not-standard-C/m-p/650956#M17185</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;When a look at the definition of the struct tm in mqx.h I see that it is a little different then standard C. Here is the definition in mqx.h:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;struct tm {&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*! \brief Range from 0 to 59. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int32_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tm_sec;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*! \brief Range from 0 to 59. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int32_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tm_min;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*! \brief Range from 0 to 23. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int32_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tm_hour;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*! \brief Range from 0 to 30, depend on month. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int32_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tm_mday;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*! \brief Range from 0 to 11. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int32_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tm_mon;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*! \brief Range from 0, since 1900. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int32_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tm_year;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*! \brief Range from 0 to 6. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int32_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tm_wday;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*! \brief Range from 0 to 365. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int32_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tm_yday;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*! \brief A flag that indicates whether daylight saving&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;nbsp; time is in effect at the time described&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int32_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tm_isdst;&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see, tm_mday is ranged from 0 to 30. According to C standard, tm_mday should be ranged from 1 to 31.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this normal?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 11:54:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-quot-struct-tm-quot-not-standard-C/m-p/650956#M17185</guid>
      <dc:creator>hbouch</dc:creator>
      <dc:date>2016-10-19T11:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: MQX "struct tm" not standard C</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-quot-struct-tm-quot-not-standard-C/m-p/650957#M17186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp; Hugo:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is normal. &amp;nbsp;&amp;nbsp; tm structure is a broken-down time format. you need conversion functions mktime, gmtime_r, timegm convert between this tm struct and the _time_t.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, in function mktime&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* The first day of month in DATE_STRUCT is 1, while in tm struct is 0*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; date.DAY&amp;nbsp;&amp;nbsp;&amp;nbsp; = (int32_t)tm_ptr-&amp;gt;tm_mday + 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* The first month of year in DATE_STRUCT is 1, while in tm struct is 0*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; date.MONTH&amp;nbsp; = (int32_t)tm_ptr-&amp;gt;tm_mon&amp;nbsp; + 1;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2016 06:13:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-quot-struct-tm-quot-not-standard-C/m-p/650957#M17186</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2016-10-20T06:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: MQX "struct tm" not standard C</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-quot-struct-tm-quot-not-standard-C/m-p/650958#M17187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know there is conversion functions to convert between broken-down time format and unix format and that's exactly the problem. I have a RTC which I have to set. I get the command and time to set from a telnet connection from a PC. When I fill the broken-down time structure, if I respect the standard C of struct tm, the date saved is not what I would expect. It is one day later. I have to substract 1 to tm_mday to be compatible with MQX struct tm. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know it's not a big deal and I can live with that. But why didn't MQX respect the C standard ? Why is MQX implementing time.c file when it is already provided by the standard C librairies of all C compilers?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Hugo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2016 08:40:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-quot-struct-tm-quot-not-standard-C/m-p/650958#M17187</guid>
      <dc:creator>hbouch</dc:creator>
      <dc:date>2016-10-20T08:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: MQX "struct tm" not standard C</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-quot-struct-tm-quot-not-standard-C/m-p/650959#M17188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wish I had noticed this sooner.&lt;/P&gt;&lt;P&gt;I have been implementing a daylight saving plan&amp;nbsp;in my project and&amp;nbsp;have wasted a few days, thinking I had got my math wrong, only to discover this discrepancy :-(&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is changed to be C compliant then it will break existing code that has worked around the problem so I guess it will have to stay this way.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Apr 2017 08:22:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-quot-struct-tm-quot-not-standard-C/m-p/650959#M17188</guid>
      <dc:creator>adyr</dc:creator>
      <dc:date>2017-04-06T08:22:46Z</dc:date>
    </item>
  </channel>
</rss>

