Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* struct timeval problem
@ 1999-01-15 21:00 Munagala V. S. Ramanath
  1999-01-15 21:13 ` Greg Lindahl
  0 siblings, 1 reply; 3+ messages in thread
From: Munagala V. S. Ramanath @ 1999-01-15 21:00 UTC (permalink / raw)
  To: axp-list

Hi,

Just noticed a discrepancy in RH 5.2 in the way 'struct timeval' is
defined in /usr/include/timebits.H:

struct timeval 
  {
    int tv_sec;                 /* Seconds.  */
    int tv_usec;                /* Microseconds.  */
  };

This seems incorrect since the man page for gettimeofday says:
--------------------
gettimeofday  and settimeofday can set the time as well as
a timezone.  tv is a  timeval  struct,  as  specified   in
/usr/include/sys/time.h:

struct timeval {
    long tv_sec;        /* seconds */
    long tv_usec;  /* microseconds */
};
--------------------

However, on RH 5.2 x86, the members are 'time_t' rather than 'int'.

This means that code that previously did this:
    gettimeofday( &p, &q ) ;
    s = ctime( &p.tv_sec ) ;

now needs to do this:

    time_t tmp ;
    gettimeofday( &p, &q ) ;
    tmp = p.tv_sec ;
    s = ctime( &tmp ) ;

Does anyone know if this is intentional or a bug ?  Thanks.

Ram


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

end of thread, other threads:[~1999-01-16  4:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-01-15 21:00 struct timeval problem Munagala V. S. Ramanath
1999-01-15 21:13 ` Greg Lindahl
1999-01-16  3:43   ` Richard Henderson

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