Converting to timeval/timespec need casts on 32bit

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2020-02-22 10:57:09 +01:00 committed by eboasson
parent 6dc28db197
commit 5aeace912b
2 changed files with 4 additions and 4 deletions

View file

@ -109,8 +109,8 @@ ddsrt_cond_waituntil(
return true;
}
if (abstime > 0) {
ts.tv_sec = abstime / DDS_NSECS_IN_SEC;
ts.tv_nsec = abstime % DDS_NSECS_IN_SEC;
ts.tv_sec = (time_t) (abstime / DDS_NSECS_IN_SEC);
ts.tv_nsec = (suseconds_t) (abstime % DDS_NSECS_IN_SEC);
}
switch (pthread_cond_timedwait(&cond->cond, &mutex->mutex, &ts)) {

View file

@ -26,8 +26,8 @@ void dds_sleepfor(dds_duration_t n)
struct timespec t, r;
if (n >= 0) {
t.tv_sec = n / DDS_NSECS_IN_SEC;
t.tv_nsec = n % DDS_NSECS_IN_SEC;
t.tv_sec = (time_t) (n / DDS_NSECS_IN_SEC);
t.tv_nsec = (long) (n % DDS_NSECS_IN_SEC);
while (nanosleep(&t, &r) == -1 && errno == EINTR) {
t = r;
}