From: steffers@earth.uni-muenster.de (Georg Steffers)
To: axp-list@redhat.com
Subject: Re: what does struct timeval look like on alpha ?
Date: Tue, 15 Jun 1999 23:50:38 +0200 (METDST) [thread overview]
Message-ID: <199906152150.XAA08340@earth.uni-muenster.de> (raw)
In-Reply-To: <37665650.914DF422@voicenet.com> from "Uncle George" at Jun 15, 99 09:34:08 am
Ok, i try to do my best to serve this list so an answer to this too.
I hope i am right, if not please tell it to me.....
First, the parts of struct timeval are int, what means long because int is
only an alias on this on alpha-machines. (int may be an alias to an other
data-type on other machines) long and int are both 4 byte.
I tried this with a simple sizeof(int) and sizeof(long) call.
What exacly do you mean if you say <if timeval is defined with ints>
Did you change the libc include-files?? On my system the values ARE defined
as int in /usr/include/timebits.h and your code compiles and run on it very
well....even if i change your l-valiable to int.
Georg
>
> with gettimeofday() it appears that struct timeval is of int's.
>
> With getrusage(), timeval needs to be of long's.
>
> SO WHAT's the definition of timeval on the alpha with RH 6.0 & GLIBC
> 2.1.x
>
> signed
> Confused in New Jersey.
>
>
> following Sample pgm that seg-faults if timeval is defined with int's
>
> typedef long jlong;
> jlong gethrvtime_us();
>
> #include <sys/time.h>
> #include <sys/resource.h>
> #include <unistd.h>
>
>
> main()
> {
> long l;
> l = gethrvtime_us();
> }
>
> jlong gethrvtime_us()
> {
> #if 1
> struct rusage usage;
> getrusage( RUSAGE_SELF, &usage);
> usage.ru_utime.tv_sec += usage.ru_stime.tv_sec;
> usage.ru_utime.tv_usec += usage.ru_stime.tv_usec;
> if ( usage.ru_utime.tv_usec >= 1000000 ) {
> usage.ru_utime.tv_sec++;
> usage.ru_utime.tv_usec -= 1000000;
> };
> #if 0
> jio_fprintf(stderr,"gethrvtime:%ds%dus\n",
> usage.ru_utime.tv_sec,
> usage.ru_utime.tv_usec);
> #endif
> /* return value in microseconds */
> return((usage.ru_utime.tv_sec*1000L*1000L +
> usage.ru_utime.tv_usec));
> #endif
>
> }
> ~
> ~
>
> --
> To unsubscribe: send e-mail to axp-list-request@redhat.com with
> 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
>
next prev parent reply other threads:[~1999-06-15 22:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-06-15 13:34 what does struct timeval look like on alpha ? Uncle George
1999-06-15 21:50 ` Georg Steffers [this message]
1999-06-16 0:27 ` Wes Bauske
1999-06-16 7:55 ` Uncle George
1999-06-19 20:16 ` Richard Henderson
1999-06-20 22:07 ` Meryem Kazanfer
1999-06-20 0:40 ` Wes Bauske
1999-06-20 3:58 ` Richard Henderson
1999-06-20 22:01 ` Uncle George
1999-06-20 22:28 ` Richard Henderson
1999-06-20 23:27 ` Uncle George
1999-06-22 4:34 ` Richard Henderson
1999-06-22 10:05 ` Uncle George
1999-06-27 4:54 ` Richard Henderson
1999-06-27 8:11 ` Uncle George
1999-06-27 20:18 ` Richard Henderson
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