- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Process Information
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-22-2009 10:39 PM
тАО12-22-2009 10:39 PM
Is there a way to know the process start time after 24 hours?
After 24 hours, it starts showing the date instead of time.
Thank you.
Ravi
Solved! Go to Solution.
- Tags:
- PS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-23-2009 12:12 AM
тАО12-23-2009 12:12 AM
Re: Process Information
> instead of time.
What is this "it"?
As usual, showing actual commands with their
actual output can be more helpful than vague
descriptions and interpretations.
"uname -a" would be a good place to start,
too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-23-2009 02:03 AM
- Tags:
- pstat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-23-2009 04:36 AM
тАО12-23-2009 04:36 AM
Re: Process Information
etime gives the time in day-h:m:s
else pstat_getproc() in a c program
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-30-2009 01:32 AM
тАО12-30-2009 01:32 AM
Re: Process Information
Thank you very much.
Ravi.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-30-2009 03:51 PM
тАО12-30-2009 03:51 PM
Re: Process Information
#include
#include
char *sep="::-x"; int coefs[]={1,60,3600,3600*24,0};
main(c,v)
int c;
char **v;
{
int t;
char buf[255];
int dt=0;
int icoef=0;
time(&t);
while (*sep)
{
char *r;
char *p=strrchr(v[1],*sep++);
r=v[1];
if (p!=NULL )
{
*p=0;
r=p+1;
}
dt=dt+atoi(r) *(coefs[icoef++]);
*r=0;
}
t-=dt;
strftime(buf,256,"%y/%m/%d %H:%M:%S",localtime(&t));
printf("%s\n",buf);
}
cc etimetodate.c -o etimetodate
etimetodate 2-02:01:01
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-31-2009 03:28 AM
тАО12-31-2009 03:28 AM
Re: Process Information
I have created a user with c shell and run the script as mentioned.
I am receiving the following error.
Warning 942: "etimetodate.c", line 12 # Types 'long *' and 'int *' are not assignment-compatible.
time(&t);
^
Warning 942: "etimetodate.c", line 27 # Types 'const long *' and 'int *' are not assignment-compatible.
strftime(buf,256,"%y/%m/%d %H:%M:%S",localtime(&t));
Could you please help me? I am not good a C.
Ravi.
- Tags:
- csh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-31-2009 07:15 AM
тАО12-31-2009 07:15 AM
Re: Process Information
since we compile in 32bits mode, long and int are compatible.
if you want to avoid them just replace
int t;
by
long t;
Happy new year
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-31-2009 08:14 AM
тАО12-31-2009 08:14 AM
Re: Process Information
Why would you want to use the scummy C shell? Also this is a C program, not a script.
>Laurent: It is not important, since we compile in 32bits mode, long and int are compatible.
It is better to be correct in all modes.
>if you want to avoid them just replace
The correct typedef is time_t, not int nor long. See time(2).
>time(&t);
A faster version that doesn't make the kernel sweat is:
t = time(NULL);
>char buf[255];
>strftime(buf, 256, "%y/%m/%d %H:%M:%S", localtime(&t));
Instead of getting the sizes wrong, you should use sizeof, provided buf isn't a parm:
strftime(buf, sizeof(buf), "%y/%m/%d %H:%M:%S", localtime(&t));
>#include
Note: The correct ANSI C header is
- Tags:
- scummy C shell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-01-2010 08:17 AM
тАО01-01-2010 08:17 AM
Re: Process Information
I have modified int t to long t. It works.
The new program looks like following, please correct me if I am wrong.
#include
#include
char *sep="::-x"; int coefs[]={1,60,3600,3600*24,0};
main(c,v)
int c;
char **v;
{
long t;
char buf[255];
int dt=0;
int icoef=0;
time(&t);
while (*sep)
{
char *r;
char *p=strrchr(v[1],*sep++);
r=v[1];
if (p!=NULL )
{
*p=0;
r=p+1;
}
dt=dt+atoi(r) *(coefs[icoef++]);
*r=0;
}
t-=dt;
strftime(buf, 256, "%y/%m/%d %H:%M:%S", localtime(&t));
printf("%s\n",buf);
}
Thank you very much.
Hi Dennis,
I have modifed the script to the following. This also works. Any other suggestions.
#include
#include
char *sep="::-x"; int coefs[]={1,60,3600,3600*24,0};
main(c,v)
int c;
char **v;
{
time_t t;
char buf[255];
int dt=0;
int icoef=0;
t = time(NULL);
while (*sep)
{
char *r;
char *p=strrchr(v[1],*sep++);
r=v[1];
if (p!=NULL )
{
*p=0;
r=p+1;
}
dt=dt+atoi(r) *(coefs[icoef++]);
*r=0;
}
t-=dt;
strftime(buf, sizeof(buf), "%y/%m/%d %H:%M:%S", localtime(&t));
printf("%s\n",buf);
}