Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Fred Roy <froy@gr.osf.org>
Subject: Re: Re: time(1) incorrect (Re) ... times(3) strange; clock_t == long
Date: Thu, 29 Feb 96 16:57:41 +0100	[thread overview]
Message-ID: <199602291601.LAA13459@postman.osf.org> (raw)
In-Reply-To: <m0ts9a2-000Bn5C@tartan>

Craig >If you were to compile time(1) with "gcc -Wall" you would observe some
Craig >warnings about printf int/long mismatches.  Fixing those up in the time
Craig >program made it return proper numbers.

I did it already, it does not change the times(3) behaviour... Consider the
following source code:

/* ----- */
#include <sys/times.h>
#include <unistd.h>
#include <stdio.h>
main() {
        struct tms my_tms;
        int slept;
        long ret1, ret2;

        slept=2;
        printf("going to sleep %d sec...\n", slept);

        ret1= (long)times(&my_tms);
        slept=sleep((unsigned int)slept);
        ret2= (long)times(&my_tms);

        printf("before: times() returned %ld\n", ret1);
        printf("after:  times() returned %ld\n", ret2);
}
/* ----- */

When compiled on BLADE_0.3 then runned, it outputs (for example):
-----
going to sleep 2 sec...
before: times() returned 825630364
after:  times() returned 825630366
-------
fred

P.S.: could somebody compile it on a recent RedHat AXP Linux and tell me if it
behaves the same way ? Thanks a lot.

  reply	other threads:[~1996-02-29 15:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-02-29  9:53 time(1) incorrect (Re) ... times(3) strange; clock_t == long froy
1996-02-29 14:43 ` Craig Groeschel
1996-02-29 15:57   ` Fred Roy [this message]
1996-02-29 15:42 ` Erik Troan
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox