summaryrefslogtreecommitdiff
path: root/lib-src/profile.c
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1994-02-22 19:22:11 +0000
committerKarl Heuer <kwzh@gnu.org>1994-02-22 19:22:11 +0000
commitbae98299b4c554fdaaf97c690e7f148b60dedfea (patch)
tree9b027f20b2fbe120b745b37b3351484f70d242d8 /lib-src/profile.c
parent5a1a5fd7f70bd5bce59d4bbf43203be6add86fe9 (diff)
downloademacs-bae98299b4c554fdaaf97c690e7f148b60dedfea.tar.gz
(get_time): Simplify; avoid calling index.
(main): exit on EOF.
Diffstat (limited to 'lib-src/profile.c')
-rw-r--r--lib-src/profile.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib-src/profile.c b/lib-src/profile.c
index 79e2495c7ce..be705520505 100644
--- a/lib-src/profile.c
+++ b/lib-src/profile.c
@@ -54,8 +54,6 @@ reset_watch ()
char *
get_time ()
{
- char *result = time_string;
- int i;
if (watch_not_started)
return ((char *) 0); /* call reset_watch first ! */
gettimeofday (&TV2, tzp);
@@ -64,10 +62,8 @@ get_time ()
TV2.tv_usec += 1000000;
TV2.tv_sec--;
}
- sprintf (result,"%lu.%6lu",
+ sprintf (time_string, "%lu.%06lu",
TV2.tv_sec - TV1.tv_sec, TV2.tv_usec - TV1.tv_usec);
- for (result = index (result, '.') + 1; *result == ' '; result++)
- *result = '0';
return time_string;
}
@@ -75,9 +71,8 @@ void
main ()
{
char inp[10];
- while (1)
+ while (gets (inp))
{
- gets (inp);
switch (inp[0])
{
case 'z':
@@ -90,4 +85,5 @@ main ()
exit (0);
}
}
+ exit (1);
}