<?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 Conversion problem Pl help in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040430#M93989</link>
    <description>Hi We are converting piece of code from SUN to HP and this is old code posted below getting stuck while conversion.&lt;BR /&gt;&lt;BR /&gt;   clock = time(0);&lt;BR /&gt; &lt;BR /&gt;        cftime(system_date_day,"%d",&amp;amp;clock);&lt;BR /&gt; &lt;BR /&gt;        /* this next kludge is to prevent sccs from expanding things */&lt;BR /&gt;        /* when letters are bracked by percent signs */&lt;BR /&gt; &lt;BR /&gt;        strcat(sccs_kludge,"%");&lt;BR /&gt;        strcat(sccs_kludge,"Y");&lt;BR /&gt;        strcat(sccs_kludge,"%");&lt;BR /&gt;        strcat(sccs_kludge,"m");&lt;BR /&gt;        strcat(sccs_kludge,"%");&lt;BR /&gt;        strcat(sccs_kludge,"d");&lt;BR /&gt; &lt;BR /&gt;        cftime(full_date,sccs_kludge,&amp;amp;clock);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hw do i convert the same above into HP, Pl help.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Gopala</description>
    <pubDate>Thu, 19 Jul 2007 11:24:45 GMT</pubDate>
    <dc:creator>gopala</dc:creator>
    <dc:date>2007-07-19T11:24:45Z</dc:date>
    <item>
      <title>Conversion problem Pl help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040430#M93989</link>
      <description>Hi We are converting piece of code from SUN to HP and this is old code posted below getting stuck while conversion.&lt;BR /&gt;&lt;BR /&gt;   clock = time(0);&lt;BR /&gt; &lt;BR /&gt;        cftime(system_date_day,"%d",&amp;amp;clock);&lt;BR /&gt; &lt;BR /&gt;        /* this next kludge is to prevent sccs from expanding things */&lt;BR /&gt;        /* when letters are bracked by percent signs */&lt;BR /&gt; &lt;BR /&gt;        strcat(sccs_kludge,"%");&lt;BR /&gt;        strcat(sccs_kludge,"Y");&lt;BR /&gt;        strcat(sccs_kludge,"%");&lt;BR /&gt;        strcat(sccs_kludge,"m");&lt;BR /&gt;        strcat(sccs_kludge,"%");&lt;BR /&gt;        strcat(sccs_kludge,"d");&lt;BR /&gt; &lt;BR /&gt;        cftime(full_date,sccs_kludge,&amp;amp;clock);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hw do i convert the same above into HP, Pl help.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Gopala</description>
      <pubDate>Thu, 19 Jul 2007 11:24:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040430#M93989</guid>
      <dc:creator>gopala</dc:creator>
      <dc:date>2007-07-19T11:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion problem Pl help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040431#M93990</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;not knowing, how your variable sccs_kludge is defined + allocated, I suggest to use a&lt;BR /&gt;strcpy(sccs_kludge,"%");&lt;BR /&gt;&lt;BR /&gt;for the first setting, then use your strcat()'s.&lt;BR /&gt;So no implicit NULLify of your array(?) is needed.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Thu, 19 Jul 2007 12:37:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040431#M93990</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2007-07-19T12:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion problem Pl help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040432#M93991</link>
      <description>There is no cftime under HPUX and the closest you can get to it is strftime(3C). Replacing all instances of cftime with strftime with the correct arguments should more likely do it.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 19 Jul 2007 14:16:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040432#M93991</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-07-19T14:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion problem Pl help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040433#M93992</link>
      <description>Hi Can you please send me the new code, How it looks like same equivalent in HP, We are using this part of old Proc code and I do not even know much of it but here is the place it is failing.&lt;BR /&gt;&lt;BR /&gt;I appreciate your help.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Gopala</description>
      <pubDate>Thu, 19 Jul 2007 14:57:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040433#M93992</guid>
      <dc:creator>gopala</dc:creator>
      <dc:date>2007-07-19T14:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion problem Pl help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040434#M93993</link>
      <description>&lt;!--!*#--&gt;Code snippet below shows how to use the strftime(3C) function: &lt;BR /&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;TIME.H&gt;&lt;BR /&gt;&lt;BR /&gt;int main(int argc, char *argv[])&lt;BR /&gt;{&lt;BR /&gt;    time_t clock;&lt;BR /&gt;    char buf[BUFSIZ];&lt;BR /&gt;    struct tm tmobj, *tmptr = &amp;amp;tmobj;&lt;BR /&gt;    clock = time(0);&lt;BR /&gt;    tmptr = localtime(&amp;amp;clock);&lt;BR /&gt;    strftime(buf, sizeof(buf), "%a %b %d %H:%M:%S %Z %Y", tmptr);&lt;BR /&gt;    printf("%s\n", buf);&lt;BR /&gt;}&lt;/TIME.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Thu, 19 Jul 2007 15:23:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040434#M93993</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-07-19T15:23:53Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion problem Pl help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040435#M93994</link>
      <description>The specific format string i.e. "%a %b %d %H:%M:%S %Z %Y" was used only to make the output resemble that of the date(1) command. You can change it to whatever you prefer. See the manpage of strftime(3C) for details.&lt;BR /&gt;&lt;BR /&gt;~cheers</description>
      <pubDate>Thu, 19 Jul 2007 15:31:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040435#M93994</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-07-19T15:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion problem Pl help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040436#M93995</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;I highly appreciate your response.&lt;BR /&gt;&lt;BR /&gt;I converted to the below and getting core dump, Pl let me know what we are doing worng, Also when we pass that varaible to other program the full_date converts to sysdate in 20070720 in that format.&lt;BR /&gt;&lt;BR /&gt; time_t  clock;&lt;BR /&gt;        char    system_date_day[3];&lt;BR /&gt;        char    revenue_date[7];&lt;BR /&gt;        char    full_date[9];&lt;BR /&gt;         char    sccs_kludge[7];&lt;BR /&gt;        struct tm *time_ptr;&lt;BR /&gt; struct tm *time_ptr;&lt;BR /&gt;#ifdef DBGtrace&lt;BR /&gt;        printf("in get_tcm\n");&lt;BR /&gt;#endif&lt;BR /&gt;&lt;BR /&gt;        /*clock = time(0);&lt;BR /&gt;        strftime(system_date_day,3,"%d",&amp;amp;clock);&lt;BR /&gt;        */&lt;BR /&gt;&lt;BR /&gt;        time_ptr = gmtime(&amp;amp;clock);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;        clock = time(0);&lt;BR /&gt;&lt;BR /&gt;        strftime(system_date_day,3,"%d",time_ptr);&lt;BR /&gt;&lt;BR /&gt;        /* this next kludge is to prevent sccs from expanding things */&lt;BR /&gt;        /* when letters are bracked by percent signs */&lt;BR /&gt;&lt;BR /&gt;        strcat(sccs_kludge,"%");&lt;BR /&gt;        strcat(sccs_kludge,"Y");&lt;BR /&gt;        strcat(sccs_kludge,"%");&lt;BR /&gt;  strcat(sccs_kludge,"m");&lt;BR /&gt;        strcat(sccs_kludge,"%");&lt;BR /&gt;        strcat(sccs_kludge,"d");&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;        strftime(full_date,9,sccs_kludge,time_ptr);</description>
      <pubDate>Fri, 20 Jul 2007 09:07:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040436#M93995</guid>
      <dc:creator>gopala</dc:creator>
      <dc:date>2007-07-20T09:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion problem Pl help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040437#M93996</link>
      <description>&amp;gt;struct tm *time_ptr;&lt;BR /&gt;&lt;BR /&gt;above struct is declared twice; not sure if you meant to declare an object of that type plus a pointer to it as in:&lt;BR /&gt;&lt;BR /&gt;struct tm tmobj;&lt;BR /&gt;struct tm *tmptr;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;time_ptr = gmtime(&amp;amp;clock);&lt;BR /&gt;&lt;BR /&gt;&amp;gt;clock = time(0);&lt;BR /&gt;&lt;BR /&gt;"clock" variable is initialized after extracting its value with the gmtime() function which is incorrect. Swap the two statements around:&lt;BR /&gt;&lt;BR /&gt;clock=time(0);&lt;BR /&gt;time_ptr=gmtime(&amp;amp;clock);&lt;BR /&gt;&lt;BR /&gt;Other than giving erroneous results it does not core dump on my PARISC system. What machine and OS are you using? Try to get a stack trace from the core file.</description>
      <pubDate>Fri, 20 Jul 2007 10:02:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040437#M93996</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-07-20T10:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion problem Pl help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040438#M93997</link>
      <description>okay, At present We fixed the problem using some other way. &lt;BR /&gt;&lt;BR /&gt;Yesterday we got coredump and today it ran well but without the correct data, So we put another fix to copy value into the varaible.&lt;BR /&gt;&lt;BR /&gt;I appreciate your response.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Gopala</description>
      <pubDate>Fri, 20 Jul 2007 10:22:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040438#M93997</guid>
      <dc:creator>gopala</dc:creator>
      <dc:date>2007-07-20T10:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion problem Pl help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040439#M93998</link>
      <description>As mentioned by Peter, you still haven't fixed your first strcat.  This will randomly fail if there are no null chars in sccs_kludge.&lt;BR /&gt;&lt;BR /&gt;In fact, you should NOT be using strcat nor strcpy.  Use an array initializer:&lt;BR /&gt;char sccs_kludge[7] = { '%', 'Y', '%', 'm', '%', 'd' };&lt;BR /&gt;&lt;BR /&gt;Instead of hardcoding 9 here: strftime(full_date,9&lt;BR /&gt;you should use: strftime(full_date,sizeof(full_date)</description>
      <pubDate>Fri, 20 Jul 2007 23:29:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/conversion-problem-pl-help/m-p/4040439#M93998</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-07-20T23:29:51Z</dc:date>
    </item>
  </channel>
</rss>

