<?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: Process Information in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215903#M678965</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have created a user with c shell and run the script as mentioned.&lt;BR /&gt;&lt;BR /&gt;I am receiving the following error.&lt;BR /&gt;&lt;BR /&gt;Warning 942: "etimetodate.c", line 12 # Types 'long *' and 'int *' are not assignment-compatible.&lt;BR /&gt;    time(&amp;amp;t);&lt;BR /&gt;         ^&lt;BR /&gt;Warning 942: "etimetodate.c", line 27 # Types 'const long *' and 'int *' are not assignment-compatible.&lt;BR /&gt;    strftime(buf,256,"%y/%m/%d %H:%M:%S",localtime(&amp;amp;t));&lt;BR /&gt;&lt;BR /&gt;Could you please help me? I am not good a C.&lt;BR /&gt;&lt;BR /&gt;Ravi.</description>
    <pubDate>Thu, 31 Dec 2009 11:28:09 GMT</pubDate>
    <dc:creator>G V R Shankar</dc:creator>
    <dc:date>2009-12-31T11:28:09Z</dc:date>
    <item>
      <title>Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215897#M678959</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;Is there a way to know the process start time after 24 hours?&lt;BR /&gt;&lt;BR /&gt;After 24 hours, it starts showing the date instead of time.&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;BR /&gt;&lt;BR /&gt;Ravi</description>
      <pubDate>Wed, 23 Dec 2009 06:39:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215897#M678959</guid>
      <dc:creator>G V R Shankar</dc:creator>
      <dc:date>2009-12-23T06:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215898#M678960</link>
      <description>&lt;!--!*#--&gt;&amp;gt; After 24 hours, it starts showing the date&lt;BR /&gt;&amp;gt; instead of time.&lt;BR /&gt;&lt;BR /&gt;What is this "it"?&lt;BR /&gt;&lt;BR /&gt;As usual, showing actual commands with their&lt;BR /&gt;actual output can be more helpful than vague&lt;BR /&gt;descriptions and interpretations.&lt;BR /&gt;&lt;BR /&gt;"uname -a" would be a good place to start,&lt;BR /&gt;too.</description>
      <pubDate>Wed, 23 Dec 2009 08:12:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215898#M678960</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2009-12-23T08:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215899#M678961</link>
      <description>I assume you are talking about ps(1)?&lt;BR /&gt;I don't see any evidence of how to get more details.  Except by rolling your own with pstat_getproc(2)?</description>
      <pubDate>Wed, 23 Dec 2009 10:03:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215899#M678961</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-12-23T10:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215900#M678962</link>
      <description>UNIX95= ps -o pid,comm,etime&lt;BR /&gt;&lt;BR /&gt;etime gives the time in day-h:m:s&lt;BR /&gt;else pstat_getproc() in a c program</description>
      <pubDate>Wed, 23 Dec 2009 12:36:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215900#M678962</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2009-12-23T12:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215901#M678963</link>
      <description>Could you please share a script that can give me the process start time using the elapsed time?&lt;BR /&gt;&lt;BR /&gt;Thank you very much.&lt;BR /&gt;&lt;BR /&gt;Ravi.</description>
      <pubDate>Wed, 30 Dec 2009 09:32:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215901#M678963</guid>
      <dc:creator>G V R Shankar</dc:creator>
      <dc:date>2009-12-30T09:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215902#M678964</link>
      <description>I use C&lt;BR /&gt;#include &lt;TIME.H&gt;&lt;BR /&gt;#include &lt;STRINGS.H&gt;&lt;BR /&gt;char *sep="::-x"; int coefs[]={1,60,3600,3600*24,0};&lt;BR /&gt;main(c,v)&lt;BR /&gt;int c;&lt;BR /&gt;char **v;&lt;BR /&gt;{&lt;BR /&gt;  int t;&lt;BR /&gt;  char buf[255];&lt;BR /&gt;  int dt=0;&lt;BR /&gt;  int icoef=0;&lt;BR /&gt;  time(&amp;amp;t);&lt;BR /&gt;  while (*sep)&lt;BR /&gt;  {&lt;BR /&gt;      char *r;&lt;BR /&gt;      char *p=strrchr(v[1],*sep++);&lt;BR /&gt;      r=v[1];&lt;BR /&gt;      if (p!=NULL )&lt;BR /&gt;      {&lt;BR /&gt;          *p=0;&lt;BR /&gt;          r=p+1;&lt;BR /&gt;      }&lt;BR /&gt;      dt=dt+atoi(r) *(coefs[icoef++]);&lt;BR /&gt;      *r=0;&lt;BR /&gt;   }&lt;BR /&gt;   t-=dt;&lt;BR /&gt;   strftime(buf,256,"%y/%m/%d %H:%M:%S",localtime(&amp;amp;t));&lt;BR /&gt;  printf("%s\n",buf);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;cc etimetodate.c -o etimetodate&lt;BR /&gt;etimetodate 2-02:01:01&lt;BR /&gt;&lt;/STRINGS.H&gt;&lt;/TIME.H&gt;</description>
      <pubDate>Wed, 30 Dec 2009 23:51:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215902#M678964</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2009-12-30T23:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215903#M678965</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have created a user with c shell and run the script as mentioned.&lt;BR /&gt;&lt;BR /&gt;I am receiving the following error.&lt;BR /&gt;&lt;BR /&gt;Warning 942: "etimetodate.c", line 12 # Types 'long *' and 'int *' are not assignment-compatible.&lt;BR /&gt;    time(&amp;amp;t);&lt;BR /&gt;         ^&lt;BR /&gt;Warning 942: "etimetodate.c", line 27 # Types 'const long *' and 'int *' are not assignment-compatible.&lt;BR /&gt;    strftime(buf,256,"%y/%m/%d %H:%M:%S",localtime(&amp;amp;t));&lt;BR /&gt;&lt;BR /&gt;Could you please help me? I am not good a C.&lt;BR /&gt;&lt;BR /&gt;Ravi.</description>
      <pubDate>Thu, 31 Dec 2009 11:28:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215903#M678965</guid>
      <dc:creator>G V R Shankar</dc:creator>
      <dc:date>2009-12-31T11:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215904#M678966</link>
      <description>it is not important,&lt;BR /&gt;since we compile in 32bits mode, long and int are compatible.&lt;BR /&gt; &lt;BR /&gt;if you want to avoid them just replace&lt;BR /&gt;int t;&lt;BR /&gt;by&lt;BR /&gt;long t;&lt;BR /&gt;&lt;BR /&gt;Happy new year&lt;BR /&gt;</description>
      <pubDate>Thu, 31 Dec 2009 15:15:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215904#M678966</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2009-12-31T15:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215905#M678967</link>
      <description>&amp;gt;I have created a user with C shell and run the script as mentioned.&lt;BR /&gt;&lt;BR /&gt;Why would you want to use the scummy C shell?  Also this is a C program, not a script.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Laurent: It is not important, since we compile in 32bits mode, long and int are compatible.&lt;BR /&gt;&lt;BR /&gt;It is better to be correct in all modes.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;if you want to avoid them just replace&lt;BR /&gt;&lt;BR /&gt;The correct typedef is time_t, not int nor long.  See time(2).&lt;BR /&gt;&lt;BR /&gt;&amp;gt;time(&amp;amp;t);&lt;BR /&gt;&lt;BR /&gt;A faster version that doesn't make the kernel sweat is:&lt;BR /&gt;t = time(NULL);&lt;BR /&gt;&lt;BR /&gt;&amp;gt;char buf[255];&lt;BR /&gt;&amp;gt;strftime(buf, 256, "%y/%m/%d %H:%M:%S", localtime(&amp;amp;t));&lt;BR /&gt;&lt;BR /&gt;Instead of getting the sizes wrong, you should use sizeof, provided buf isn't a parm:&lt;BR /&gt;strftime(buf, sizeof(buf), "%y/%m/%d %H:%M:%S", localtime(&amp;amp;t));&lt;BR /&gt;&lt;BR /&gt;&amp;gt;#include &lt;STRINGS.H&gt;&lt;BR /&gt;&lt;BR /&gt;Note: The correct ANSI C header is &lt;STRING.H&gt;.&lt;/STRING.H&gt;&lt;/STRINGS.H&gt;</description>
      <pubDate>Thu, 31 Dec 2009 16:14:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215905#M678967</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-12-31T16:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215906#M678968</link>
      <description>Hi Laurent,&lt;BR /&gt;&lt;BR /&gt;I have modified int t to long t. It works. &lt;BR /&gt;&lt;BR /&gt;The new program looks like following, please correct me if I am wrong.&lt;BR /&gt;&lt;BR /&gt;#include &lt;TIME.H&gt;&lt;BR /&gt;#include &lt;STRING.H&gt;&lt;BR /&gt;char *sep="::-x"; int coefs[]={1,60,3600,3600*24,0};&lt;BR /&gt;main(c,v)&lt;BR /&gt;int c;&lt;BR /&gt;char **v;&lt;BR /&gt;{&lt;BR /&gt;long t;&lt;BR /&gt;char buf[255];&lt;BR /&gt;int dt=0;&lt;BR /&gt;int icoef=0;&lt;BR /&gt;time(&amp;amp;t);&lt;BR /&gt;while (*sep)&lt;BR /&gt;{&lt;BR /&gt;char *r;&lt;BR /&gt;char *p=strrchr(v[1],*sep++);&lt;BR /&gt;r=v[1];&lt;BR /&gt;if (p!=NULL )&lt;BR /&gt;{&lt;BR /&gt;*p=0;&lt;BR /&gt;r=p+1;&lt;BR /&gt;}&lt;BR /&gt;dt=dt+atoi(r) *(coefs[icoef++]);&lt;BR /&gt;*r=0;&lt;BR /&gt;}&lt;BR /&gt;t-=dt;&lt;BR /&gt;strftime(buf, 256, "%y/%m/%d %H:%M:%S", localtime(&amp;amp;t));&lt;BR /&gt;printf("%s\n",buf);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Thank you very much.&lt;BR /&gt;&lt;BR /&gt;Hi Dennis,&lt;BR /&gt;&lt;BR /&gt;I have modifed the script to the following. This also works. Any other suggestions.&lt;BR /&gt;&lt;BR /&gt;#include &lt;TIME.H&gt;&lt;BR /&gt;#include &lt;STRING.H&gt;&lt;BR /&gt;char *sep="::-x"; int coefs[]={1,60,3600,3600*24,0};&lt;BR /&gt;main(c,v)&lt;BR /&gt;int c;&lt;BR /&gt;char **v;&lt;BR /&gt;{&lt;BR /&gt;time_t t;&lt;BR /&gt;char buf[255];&lt;BR /&gt;int dt=0;&lt;BR /&gt;int icoef=0;&lt;BR /&gt;t = time(NULL);&lt;BR /&gt;while (*sep)&lt;BR /&gt;{&lt;BR /&gt;char *r;&lt;BR /&gt;char *p=strrchr(v[1],*sep++);&lt;BR /&gt;r=v[1];&lt;BR /&gt;if (p!=NULL )&lt;BR /&gt;{&lt;BR /&gt;*p=0;&lt;BR /&gt;r=p+1;&lt;BR /&gt;}&lt;BR /&gt;dt=dt+atoi(r) *(coefs[icoef++]);&lt;BR /&gt;*r=0;&lt;BR /&gt;}&lt;BR /&gt;t-=dt;&lt;BR /&gt;strftime(buf, sizeof(buf), "%y/%m/%d %H:%M:%S", localtime(&amp;amp;t));&lt;BR /&gt;printf("%s\n",buf);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/STRING.H&gt;&lt;/TIME.H&gt;&lt;/STRING.H&gt;&lt;/TIME.H&gt;</description>
      <pubDate>Fri, 01 Jan 2010 16:17:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215906#M678968</guid>
      <dc:creator>G V R Shankar</dc:creator>
      <dc:date>2010-01-01T16:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215907#M678969</link>
      <description>Hi Laurent and all,&lt;BR /&gt;&lt;BR /&gt;Forgot to mention. I wish you and your beloved ones a very happy and prosperous new year 2010.&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;BR /&gt;&lt;BR /&gt;Ravi.</description>
      <pubDate>Fri, 01 Jan 2010 16:27:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215907#M678969</guid>
      <dc:creator>G V R Shankar</dc:creator>
      <dc:date>2010-01-01T16:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215908#M678970</link>
      <description>Hi Ravi:&lt;BR /&gt;&lt;BR /&gt;You could use Perl.  In fact, instead of manually running 'ps' you could use this script:&lt;BR /&gt;&lt;BR /&gt;# cat ./ps_etimes&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;#@(#) Show processes with elapsed time as a start timestamp - JRF&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;use POSIX qw(strftime);&lt;BR /&gt;my @weights  = ( 1, 60, 3600, 86400 );&lt;BR /&gt;my $now      = time();&lt;BR /&gt;$ENV{UNIX95} = 1;&lt;BR /&gt;open my $fh, 'ps -eo pid,comm,etime|' or die "Can't fork: $!\n";&lt;BR /&gt;while (&amp;lt;$fh&amp;gt;) {&lt;BR /&gt;    next if $. == 1;&lt;BR /&gt;    chomp;&lt;BR /&gt;    my ( $pid, $comm, $etime ) = split;&lt;BR /&gt;    my @a = reverse split /[:-]/, $etime;&lt;BR /&gt;    my $t = 0;&lt;BR /&gt;    for ( 0 .. @a - 1 ) {&lt;BR /&gt;        $t += $a[$_] * $weights[$_];&lt;BR /&gt;    }&lt;BR /&gt;    printf "%5d %-15s %s\n", $pid, $comm,&lt;BR /&gt;        strftime( "%Y/%m/%d %H:%M:%S", localtime( $now - $t ) );&lt;BR /&gt;}&lt;BR /&gt;1;&lt;BR /&gt;&lt;BR /&gt;The output is a process list as if you had done:&lt;BR /&gt;&lt;BR /&gt;# UNIX95= ps -eo pid,comm,etime&lt;BR /&gt;&lt;BR /&gt;...except the header line is suppressed and the 'etime' field is computed to the process instantiation timestamp instead of the elapsed 'd-h:m:s' format it normally takes.&lt;BR /&gt;&lt;BR /&gt;Simply run as:&lt;BR /&gt;&lt;BR /&gt;# ./ps_etimes&lt;BR /&gt;&lt;BR /&gt;...or for a particular process (for example):&lt;BR /&gt;&lt;BR /&gt;# ./ps_etimes | grep diaglogd&lt;BR /&gt;&lt;BR /&gt;Regards (and Happy New Year)!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Jan 2010 20:53:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215908#M678970</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-01-01T20:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215909#M678971</link>
      <description>Hi James,&lt;BR /&gt;&lt;BR /&gt;The perl script works like a charm.&lt;BR /&gt;&lt;BR /&gt;Thank you very much.&lt;BR /&gt;&lt;BR /&gt;Hi Laurent and Dennis,&lt;BR /&gt;&lt;BR /&gt;Thank you very much for the C programs.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Ravi.</description>
      <pubDate>Sat, 02 Jan 2010 08:07:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215909#M678971</guid>
      <dc:creator>G V R Shankar</dc:creator>
      <dc:date>2010-01-02T08:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215910#M678972</link>
      <description>I got want I was looking for. Both the C and Perl programs meet my objectives.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Ravi.</description>
      <pubDate>Sat, 02 Jan 2010 16:17:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215910#M678972</guid>
      <dc:creator>G V R Shankar</dc:creator>
      <dc:date>2010-01-02T16:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215911#M678973</link>
      <description>&amp;gt;JRF: # UNIX95= ps -eo pid,comm,etime&lt;BR /&gt;... except the header line is suppressed&lt;BR /&gt;&lt;BR /&gt;If you want to suppress the header line, why don't you use this instead:&lt;BR /&gt;UNIX95=EXTENDED_PS ps -e -opid= -ocomm= -oetime=&lt;BR /&gt;(And remove: next if $. == 1;)</description>
      <pubDate>Sat, 02 Jan 2010 16:32:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215911#M678973</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-01-02T16:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215912#M678974</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Dennis: If you want to suppress the header line, why don't you use this instead:&lt;BR /&gt;UNIX95=EXTENDED_PS ps -e -opid= -ocomm= -oetime=&lt;BR /&gt;(And remove: next if $. == 1;)&lt;BR /&gt;&lt;BR /&gt;I certainly could have, but chose to skip the first line to keep the command easier to ammend.  Of course in doing so, I sacrificed a few extra CPU cycles :-)&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Sat, 02 Jan 2010 16:56:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215912#M678974</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-01-02T16:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215913#M678975</link>
      <description>&amp;gt;&amp;gt;Laurent: It is not important, since we &amp;gt;compile in 32bits mode, long and int are &amp;gt;compatible.&lt;BR /&gt;&amp;gt;&lt;BR /&gt;&amp;gt;It is better to be correct in all modes.&lt;BR /&gt;yes, I agree for a long program, but what I mean is that it doesn't change the result&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;if you want to avoid them just replace&lt;BR /&gt;&amp;gt;&lt;BR /&gt;&amp;gt;The correct typedef is time_t, not int nor &amp;gt;long. See time(2).&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;time(&amp;amp;t);&lt;BR /&gt;&lt;BR /&gt;&amp;gt;A faster version that doesn't make the &amp;gt;kernel sweat is:&lt;BR /&gt;&amp;gt;t = time(NULL);&lt;BR /&gt;&lt;BR /&gt;Indeed you avoid the copyout of a long&lt;BR /&gt;which for a repetitive program run could have side effect&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;char buf[255];&lt;BR /&gt;&amp;gt;&amp;gt;strftime(buf, 256, "%y/%m/%d %H:%M:%S", &amp;gt;localtime(&amp;amp;t));&lt;BR /&gt;&amp;gt;&lt;BR /&gt;&amp;gt;Instead of getting the sizes wrong, you &amp;gt;should use sizeof, provided buf isn't a&lt;BR /&gt;&amp;gt;parm:&lt;BR /&gt;&amp;gt;strftime(buf, sizeof(buf), "%y/%m/%d &amp;gt;%H:%M:%S", localtime(&amp;amp;t));&lt;BR /&gt;Yes; indeed it is much better and due to quick and dirty copy/past. ( at least a 256 would have been better even if in that case,it will have no side effect since the format output is much smaller than the 256 bytes)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;#include &lt;STRINGS.H&gt;&lt;BR /&gt;&amp;gt;Note: The correct ANSI C header is &lt;STRING.H&gt;.&lt;BR /&gt;yes, it is old habits, like the old style main declaration,&lt;BR /&gt;main(c,v)&lt;BR /&gt;int c;&lt;BR /&gt;char **v;&lt;BR /&gt;&lt;BR /&gt;the new way is main(int c,char *v[])&lt;BR /&gt;you could also tell that #include&lt;STDIO.H&gt; is missing so printf will not be prototyped.&lt;BR /&gt;&lt;BR /&gt;I could also have included the call to pstat_getproc() in the program&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;TIME.H&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;main(int c,char *v[])&lt;BR /&gt;{&lt;BR /&gt;  struct pst_status pst;&lt;BR /&gt;  long t;&lt;BR /&gt;  int pid;&lt;BR /&gt;  char buf[256];&lt;BR /&gt;  pid=atoi(v[1]);&lt;BR /&gt;  if(pstat_getproc( &amp;amp;pst,sizeof(pst), 0 , pid)&amp;lt;0)&lt;BR /&gt;  {&lt;BR /&gt;    perror("pstat");&lt;BR /&gt;    exit(0);&lt;BR /&gt;  }&lt;BR /&gt;  t=pst.pst_start;&lt;BR /&gt;  strftime(buf,sizeof(buf),"%y/%m/%d %H:%M:%S",localtime(&amp;amp;t));&lt;BR /&gt;  printf("%s\n",buf);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/SYS&gt;&lt;/TIME.H&gt;&lt;/STDIO.H&gt;&lt;/STDIO.H&gt;&lt;/STRING.H&gt;&lt;/STRINGS.H&gt;</description>
      <pubDate>Mon, 04 Jan 2010 09:48:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215913#M678975</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2010-01-04T09:48:34Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215914#M678976</link>
      <description>&lt;!--!*#--&gt;You can also use strptime(3) to parse your time:&lt;BR /&gt;#include &lt;TIME.H&gt;&lt;BR /&gt;#include &lt;STDLIB.H&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;int main(int argc, char **argv) {&lt;BR /&gt;   int i;&lt;BR /&gt;   time_t t, t2;&lt;BR /&gt;   int dt;&lt;BR /&gt;   struct tm tm1;&lt;BR /&gt;   char buf[255];&lt;BR /&gt;   t = time(NULL);&lt;BR /&gt;   for (i = 1; i &amp;lt; argc; ++i) {&lt;BR /&gt;      // use %j to collect days&lt;BR /&gt;      char *result = strptime(argv[i], "%j-%H:%M:%S", &amp;amp;tm1);&lt;BR /&gt;      if (result) {&lt;BR /&gt;         if (*result != '\0')&lt;BR /&gt;            printf("strptime bad result: %s\n", result);&lt;BR /&gt;      } else {&lt;BR /&gt;         printf("strptime error\n");&lt;BR /&gt;      }&lt;BR /&gt;      dt = ((((tm1.tm_yday + 1) * 24 + tm1.tm_hour) * 60) + tm1.tm_min) * 60 +&lt;BR /&gt;           tm1.tm_sec;&lt;BR /&gt;      t2 = t - dt;&lt;BR /&gt;      strftime(buf, sizeof(buf), "%Y/%m/%d %H:%M:%S", localtime(&amp;amp;t2));&lt;BR /&gt;      printf("%s\n",buf);&lt;BR /&gt;   }&lt;BR /&gt;   return 0;&lt;BR /&gt;}&lt;/STDIO.H&gt;&lt;/STDLIB.H&gt;&lt;/TIME.H&gt;</description>
      <pubDate>Tue, 05 Jan 2010 03:57:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215914#M678976</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-01-05T03:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215915#M678977</link>
      <description>with the&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;TIME.H&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;main(int c,char *v[])&lt;BR /&gt;{&lt;BR /&gt;struct pst_status pst;&lt;BR /&gt;long t;&lt;BR /&gt;int pid;&lt;BR /&gt;char buf[256];&lt;BR /&gt;pid=atoi(v[1]);&lt;BR /&gt;if(pstat_getproc( &amp;amp;pst,sizeof(pst), 0 , pid)&amp;lt;0)&lt;BR /&gt;{&lt;BR /&gt;perror("pstat");&lt;BR /&gt;exit(0);&lt;BR /&gt;}&lt;BR /&gt;t=pst.pst_start;&lt;BR /&gt;strftime(buf,sizeof(buf),"%y/%m/%d %H:%M:%S",localtime(&amp;amp;t));&lt;BR /&gt;printf("%s\n",buf);&lt;BR /&gt;}&lt;BR /&gt;no need for ps anymore&lt;BR /&gt;./a.out pid   will give the start date for the given process.&lt;/SYS&gt;&lt;/TIME.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Tue, 05 Jan 2010 13:07:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215915#M678977</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2010-01-05T13:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: Process Information</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215916#M678978</link>
      <description>&amp;gt;Laurent: no need for ps anymore&lt;BR /&gt;&lt;BR /&gt;Yes, I noticed that, though the tool may want to take more than one PID.</description>
      <pubDate>Tue, 05 Jan 2010 17:23:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-information/m-p/5215916#M678978</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-01-05T17:23:54Z</dc:date>
    </item>
  </channel>
</rss>

