Display the ending time as well as the starting time of processes.
This commit is contained in:
parent
f41166264d
commit
ca9d87a5e5
@ -1,6 +1,8 @@
|
|||||||
# $NetBSD: Makefile,v 1.4 1994/12/22 01:06:58 jtc Exp $
|
# $NetBSD: Makefile,v 1.5 1995/10/22 01:43:40 ghudson Exp $
|
||||||
# @(#)Makefile 8.1 (Berkeley) 6/6/93
|
# @(#)Makefile 8.1 (Berkeley) 6/6/93
|
||||||
|
|
||||||
PROG= lastcomm
|
PROG= lastcomm
|
||||||
|
DPADD= ${LIBMATH}
|
||||||
|
LDADD= -lm
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.\" $NetBSD: lastcomm.1,v 1.4 1995/02/27 02:40:23 cgd Exp $
|
.\" $NetBSD: lastcomm.1,v 1.5 1995/10/22 01:43:41 ghudson Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1980, 1990, 1993
|
.\" Copyright (c) 1980, 1990, 1993
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
@ -97,7 +97,9 @@ The command name under which the process was called.
|
|||||||
.It
|
.It
|
||||||
The amount of cpu time used by the process (in seconds).
|
The amount of cpu time used by the process (in seconds).
|
||||||
.It
|
.It
|
||||||
The time the process exited.
|
The time the process started.
|
||||||
|
.It
|
||||||
|
The elapsed time of the process.
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
The flags are encoded as follows: ``S'' indicates the command was
|
The flags are encoded as follows: ``S'' indicates the command was
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: lastcomm.c,v 1.8 1995/10/12 03:03:49 mycroft Exp $ */
|
/* $NetBSD: lastcomm.c,v 1.9 1995/10/22 01:43:42 ghudson Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1980, 1993
|
* Copyright (c) 1980, 1993
|
||||||
@ -43,7 +43,7 @@ static char copyright[] =
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)lastcomm.c 8.2 (Berkeley) 4/29/95";
|
static char sccsid[] = "@(#)lastcomm.c 8.2 (Berkeley) 4/29/95";
|
||||||
#endif
|
#endif
|
||||||
static char rcsid[] = "$NetBSD: lastcomm.c,v 1.8 1995/10/12 03:03:49 mycroft Exp $";
|
static char rcsid[] = "$NetBSD: lastcomm.c,v 1.9 1995/10/22 01:43:42 ghudson Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -53,10 +53,12 @@ static char rcsid[] = "$NetBSD: lastcomm.c,v 1.8 1995/10/12 03:03:49 mycroft Exp
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <struct.h>
|
#include <struct.h>
|
||||||
|
#include <tzfile.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
#include "pathnames.h"
|
#include "pathnames.h"
|
||||||
@ -79,6 +81,7 @@ main(argc, argv)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
off_t size;
|
off_t size;
|
||||||
time_t t;
|
time_t t;
|
||||||
|
double delta;
|
||||||
int ch;
|
int ch;
|
||||||
char *acctfile;
|
char *acctfile;
|
||||||
|
|
||||||
@ -140,11 +143,17 @@ main(argc, argv)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
t = expand(ab.ac_utime) + expand(ab.ac_stime);
|
t = expand(ab.ac_utime) + expand(ab.ac_stime);
|
||||||
(void)printf("%-*.*s %-7s %-*.*s %-*.*s %6.2f secs %.16s\n",
|
(void)printf(
|
||||||
|
"%-*.*s %-7s %-*.*s %-*.*s %6.2f secs %.16s",
|
||||||
fldsiz(acct, ac_comm), fldsiz(acct, ac_comm), ab.ac_comm,
|
fldsiz(acct, ac_comm), fldsiz(acct, ac_comm), ab.ac_comm,
|
||||||
flagbits(ab.ac_flag), UT_NAMESIZE, UT_NAMESIZE,
|
flagbits(ab.ac_flag), UT_NAMESIZE, UT_NAMESIZE,
|
||||||
user_from_uid(ab.ac_uid, 0), UT_LINESIZE, UT_LINESIZE,
|
user_from_uid(ab.ac_uid, 0), UT_LINESIZE, UT_LINESIZE,
|
||||||
getdev(ab.ac_tty), t / (double)AHZ, ctime(&ab.ac_btime));
|
getdev(ab.ac_tty), t / (double)AHZ, ctime(&ab.ac_btime));
|
||||||
|
delta = expand(ab.ac_etime) / (double)AHZ;
|
||||||
|
printf(" (%1.0lf:%02.0lf:%05.2lf)\n",
|
||||||
|
delta / SECSPERHOUR,
|
||||||
|
fmod(delta, SECSPERHOUR) / SECSPERMIN,
|
||||||
|
fmod(delta, SECSPERMIN));
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user