<?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: mktime problem in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/mktime-problem/m-p/549497#M10995</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by nkarakotas on Fri Jul 22 02:09:30 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to use another implementation of mktime with Redlib but the stdlib.h doesnt have an implementation of setenv which is used. I tried to add setenv support but the compiler complains on the environ:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;extern char **environ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* the global which is your env. */
-- undefined reference to `environ' --&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What is the point having a getenv if you can set it?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 01:56:30 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T01:56:30Z</dc:date>
    <item>
      <title>mktime problem</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/mktime-problem/m-p/549496#M10994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by nkarakotas on Thu Jul 21 12:16:33 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Im using newlib in order to use the timezone settings redlib doesnt have. I have experimented with some values but I get some strange values. I wonder if anyone has used the functions?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example I do the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; tm.tm_hour = 3;
&amp;nbsp;&amp;nbsp;&amp;nbsp; tm.tm_min = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp; tm.tm_sec = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp; tm.tm_wday = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp; tm.tm_yday = 0;

 tm.tm_year = (2011) - 1900;
&amp;nbsp;&amp;nbsp;&amp;nbsp; tm.tm_mday = 30;
&amp;nbsp;&amp;nbsp;&amp;nbsp; tm.tm_mon = 10 - 1;
&amp;nbsp;&amp;nbsp;&amp;nbsp; tm.tm_isdst = -1;

&amp;nbsp;&amp;nbsp;&amp;nbsp; _daylight = 1;
&amp;nbsp;&amp;nbsp;&amp;nbsp; _timezone = 0;
 //&amp;nbsp;&amp;nbsp; tz = getenv("TZ");
 //&amp;nbsp;&amp;nbsp; setenv ("TZ", "GMT2", 1);
 //&amp;nbsp;&amp;nbsp; tz = getenv("TZ");
 //&amp;nbsp;&amp;nbsp; tzset();

&amp;nbsp;&amp;nbsp;&amp;nbsp; time = mktime(&amp;amp;tm);

&amp;nbsp;&amp;nbsp;&amp;nbsp; _daylight = 1;
&amp;nbsp;&amp;nbsp;&amp;nbsp; _timezone = 2 * 60 * 60;
&amp;nbsp;&amp;nbsp; tt = localtime(&amp;amp;time);&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;This outputs the same value when it should be +2&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any thoughts?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:56:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/mktime-problem/m-p/549496#M10994</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: mktime problem</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/mktime-problem/m-p/549497#M10995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by nkarakotas on Fri Jul 22 02:09:30 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to use another implementation of mktime with Redlib but the stdlib.h doesnt have an implementation of setenv which is used. I tried to add setenv support but the compiler complains on the environ:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;extern char **environ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* the global which is your env. */
-- undefined reference to `environ' --&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What is the point having a getenv if you can set it?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:56:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/mktime-problem/m-p/549497#M10995</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: mktime problem</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/mktime-problem/m-p/549498#M10996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by TheFallGuy on Fri Jul 22 03:00:04 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;AFAIK, getenv is a semihosted function - that is, it gets the environment from the host when running under a debugger. My embedded systems doesn't have any environment variables...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:56:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/mktime-problem/m-p/549498#M10996</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: mktime problem</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/mktime-problem/m-p/549499#M10997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by whitecoe on Fri Jul 22 05:14:27 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Why don't you explain what you are actually trying to achieve here? I seem to remember that the semihosting interface (original defined by ARM) only provides one call which just returns time since 1970 - with no timezone etc information allowed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thus I'm not surprised that newlib doesn't do what you want. You will probably need to implement whatever clock functions you want yourself using functionality provided by your target hardware - either fully or by providing stubs to sit under the top level C library functions.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:56:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/mktime-problem/m-p/549499#M10997</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: mktime problem</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/mktime-problem/m-p/549500#M10998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by nkarakotas on Fri Jul 22 06:41:55 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I successfully converted the time with the following code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://"&gt;http://www.google.com/codesearch#rYUC1d6HJqM/test678/zipunzip_src/unzip/timezone.c&amp;amp;q=timezone%20lang:c&amp;amp;type=cs&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I changed the getEnv to a char *TZ pointer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Upon my tests it does what I want.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nick&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:56:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/mktime-problem/m-p/549500#M10998</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: mktime problem</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/mktime-problem/m-p/549501#M10999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by riscy00 on Sun Nov 01 21:18:45 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi the link is broken, can you make new one?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:56:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/mktime-problem/m-p/549501#M10999</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:56:32Z</dc:date>
    </item>
  </channel>
</rss>

