Fix tv_sec casts to use time_t, not long

This commit is contained in:
Andrew Johnson
2017-06-09 12:20:16 -05:00
parent b369aa67f1
commit 18dee384ec
4 changed files with 5 additions and 5 deletions

View File

@@ -116,7 +116,7 @@ epicsShareFunc void fdManager::process (double delay)
if ( ioPending ) {
struct timeval tv;
tv.tv_sec = static_cast<long> ( minDelay );
tv.tv_sec = static_cast<time_t> ( minDelay );
tv.tv_usec = static_cast<long> ( (minDelay-tv.tv_sec) * uSecPerSec );
fd_set * pReadSet = & this->fdSetsPtr[fdrRead];

View File

@@ -72,7 +72,7 @@ convertDoubleToWakeTime(double timeout, struct timespec *wakeTime)
if (timeout < 0.0)
timeout = 0.0;
wait.tv_sec = static_cast< long >(timeout);
wait.tv_sec = static_cast< time_t >(timeout);
wait.tv_nsec = static_cast< long >((timeout - (double)wait.tv_sec) * 1e9);
wakeTime->tv_sec = now.tv_sec + wait.tv_sec;

View File

@@ -107,7 +107,7 @@ extern "C" epicsShareFunc void
perror("convertDoubleToWakeTime");
cantProceed("convertDoubleToWakeTime");
}
wait.tv_sec = static_cast< long >(timeout);
wait.tv_sec = static_cast< time_t >(timeout);
wait.tv_nsec = static_cast< long >((timeout - (double)wait.tv_sec) * 1e9);
wakeTime->tv_sec += wait.tv_sec;
wakeTime->tv_nsec += wait.tv_nsec;

View File

@@ -74,13 +74,13 @@ void testTimer (fdctx *pfdm, double delay)
epicsTimeGetCurrent (&begin);
cbs.done = 0;
tmo.tv_sec = (unsigned long) delay;
tmo.tv_sec = (time_t) delay;
tmo.tv_usec = (unsigned long) ((delay - tmo.tv_sec) * uSecPerSec);
aid = fdmgr_add_timeout (pfdm, &tmo, alarmCB, &cbs);
verify (aid!=fdmgrNoAlarm);
while (!cbs.done) {
tmo.tv_sec = (unsigned long) delay;
tmo.tv_sec = (time_t) delay;
tmo.tv_usec = (unsigned long) ((delay - tmo.tv_sec) * uSecPerSec);
status = fdmgr_pend_event (pfdm, &tmo);
verify (status==0);