dtime_.c (G77_dtime_0): Fix types in HAVE_GETRUSAGE case so as not to truncate results to integer values.

* libU77/dtime_.c (G77_dtime_0): Fix types in HAVE_GETRUSAGE case
        so as not to truncate results to integer values.
        * libU77/Version.c: Bump.

From-SVN: r15669
This commit is contained in:
Dave Love 1997-09-23 07:06:54 +00:00 committed by Jeff Law
parent 0774afd709
commit 5cd278f399
3 changed files with 16 additions and 8 deletions

View File

@ -1,3 +1,9 @@
1997-09-19 Dave Love <d.love@dl.ac.uk>
* libU77/dtime_.c (G77_dtime_0): Fix types in HAVE_GETRUSAGE case
so as not to truncate results to integer values.
* libU77/Version.c: Bump.
Thu Sep 18 16:58:46 1997 Jeffrey A Law (law@cygnus.com)
* Makefile.in (stamp-lib): Don't use '$?', explicitly

View File

@ -1,6 +1,6 @@
static char junk[] = "\n@(#) LIBU77 VERSION 19970609\n";
static char junk[] = "\n@(#) LIBU77 VERSION 19970919\n";
char __G77_LIBU77_VERSION__[] = "0.5.21";
char __G77_LIBU77_VERSION__[] = "0.5.22-970919";
#include <stdio.h>

View File

@ -43,21 +43,23 @@ double G77_dtime_0 (tarray)
double G77_dtime_0 (real tarray[2])
#endif
{
time_t utime, stime;
static time_t old_utime = 0, old_stime = 0;
/* The getrusage version is only the default for convenience. */
#ifdef HAVE_GETRUSAGE
float utime, stime;
static float old_utime = 0.0, old_stime = 0.0;
struct rusage rbuff;
if (getrusage (RUSAGE_SELF, &rbuff) != 0)
abort ();
utime = ((float) (rbuff.ru_utime).tv_sec +
(float) (rbuff.ru_utime).tv_usec/1000000.0);
utime = (float) (rbuff.ru_utime).tv_sec +
(float) (rbuff.ru_utime).tv_usec/1000000.0;
tarray[0] = utime - (float) old_utime;
stime = ((float) (rbuff.ru_stime).tv_sec +
(float) (rbuff.ru_stime).tv_usec/1000000.0);
stime = (float) (rbuff.ru_stime).tv_sec +
(float) (rbuff.ru_stime).tv_usec/1000000.0;
tarray[1] = stime - old_stime;
#else /* HAVE_GETRUSAGE */
time_t utime, stime;
static time_t old_utime = 0, old_stime = 0;
struct tms buffer;
/* NeXTStep seems to define _SC_CLK_TCK but not to have sysconf;