Use isc_time_secondsastimet() set timespec.tv_sec (returning an

error if the seconds are out of range), and cast isc_time_nanoseconds()
to shut up the IRIX compiler.
This commit is contained in:
David Lawrence
2000-05-18 17:13:58 +00:00
parent bc12a0c0d0
commit 87480bb860

View File

@@ -27,12 +27,24 @@
isc_result_t
isc_condition_waituntil(isc_condition_t *c, isc_mutex_t *m, isc_time_t *t) {
int presult;
isc_result_t result;
struct timespec ts;
REQUIRE(c != NULL && m != NULL && t != NULL);
ts.tv_sec = isc_time_seconds(t);
ts.tv_nsec = isc_time_nanoseconds(t);
/*
* POSIX defines a timepsec's tv_sec as time_t.
*/
result = isc_time_secondsastimet(t, &ts.tv_sec);
if (result != ISC_R_SUCCESS)
return (result);
/*
* POSIX defines a timespec's tv_nsec as long. isc_time_nanoseconds
* ensures its return value is < 1 billion, which will fit in a long.
*/
ts.tv_nsec = (long)isc_time_nanoseconds(t);
do {
presult = pthread_cond_timedwait(c, m, &ts);
if (presult == 0)