aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/time.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2004-05-11 17:51:27 +0000
committerrsc <devnull@localhost>2004-05-11 17:51:27 +0000
commitc4097c29512269f4547ebefb8abdc57a2892b479 (patch)
treee84c61a845b196bfa903088e15b772ae0b16c8bb /src/cmd/time.c
parent2f2df5e02ef22c9727ae2b8269d5c76a061d296f (diff)
downloadplan9port-c4097c29512269f4547ebefb8abdc57a2892b479.tar.gz
plan9port-c4097c29512269f4547ebefb8abdc57a2892b479.tar.bz2
plan9port-c4097c29512269f4547ebefb8abdc57a2892b479.zip
Fix small bugs.
Diffstat (limited to 'src/cmd/time.c')
-rw-r--r--src/cmd/time.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cmd/time.c b/src/cmd/time.c
index d82eaa94..3b52216b 100644
--- a/src/cmd/time.c
+++ b/src/cmd/time.c
@@ -11,6 +11,7 @@ main(int argc, char *argv[])
{
int i;
Waitmsg *w;
+ vlong t0, t1;
long l;
char *p;
char err[ERRMAX];
@@ -20,6 +21,7 @@ main(int argc, char *argv[])
exits("usage");
}
+ t0 = nsec();
switch(fork()){
case -1:
error("fork");
@@ -37,8 +39,9 @@ main(int argc, char *argv[])
loop:
w = wait();
+ t1 = nsec();
if(w == nil){
- errstr(err, sizeof err);
+ rerrstr(err, sizeof err);
if(strcmp(err, "interrupted") == 0)
goto loop;
error("wait");
@@ -47,7 +50,7 @@ main(int argc, char *argv[])
add("%ld.%.2ldu", l/1000, (l%1000)/10);
l = w->time[1];
add("%ld.%.2lds", l/1000, (l%1000)/10);
- l = w->time[2];
+ l = (t1-t0)/1000000;
add("%ld.%.2ldr", l/1000, (l%1000)/10);
add("\t");
for(i=1; i<argc; i++){