From: "Munagala V. S. Ramanath" <ram@netcom.com>
To: axp-list@redhat.com
Subject: struct timeval problem
Date: Fri, 15 Jan 1999 13:00:20 -0800 (PST) [thread overview]
Message-ID: <199901152100.NAA21342@netcom11.netcom.com> (raw)
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
next reply other threads:[~1999-01-15 21:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-01-15 21:00 Munagala V. S. Ramanath [this message]
1999-01-15 21:13 ` struct timeval problem Greg Lindahl
1999-01-16 3:43 ` 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