Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* what does struct timeval look like on alpha ?
@ 1999-06-15 13:34 Uncle George
  1999-06-15 21:50 ` Georg Steffers
  0 siblings, 1 reply; 16+ messages in thread
From: Uncle George @ 1999-06-15 13:34 UTC (permalink / raw)
  To: axp-list

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

}
~
~


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~1999-06-27 21:15 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-06-15 13:34 what does struct timeval look like on alpha ? Uncle George
1999-06-15 21:50 ` Georg Steffers
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

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