Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Uncle George <gatgul@voicenet.com>
To: axp-list@redhat.com
Subject: what does struct timeval look like on alpha ?
Date: Tue, 15 Jun 1999 09:34:08 -0400	[thread overview]
Message-ID: <37665650.914DF422@voicenet.com> (raw)

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

}
~
~


             reply	other threads:[~1999-06-15 14:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-15 13:34 Uncle George [this message]
1999-06-15 21:50 ` what does struct timeval look like on alpha ? 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
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