Index: src/OFKqueueKernelEventObserver.m ================================================================== --- src/OFKqueueKernelEventObserver.m +++ src/OFKqueueKernelEventObserver.m @@ -17,11 +17,10 @@ #include "config.h" #include #include -#include #ifdef HAVE_FCNTL_H # include #endif #include "unistd_wrapper.h" @@ -163,11 +162,11 @@ if ([self of_processReadBuffers]) return; timeout.tv_sec = (time_t)timeInterval; - timeout.tv_nsec = lrint((timeInterval - timeout.tv_sec) * 1000000000); + timeout.tv_nsec = (timeInterval - timeout.tv_sec) * 1000000000; events = kevent(_kernelQueue, NULL, 0, eventList, EVENTLIST_SIZE, (timeInterval != -1 ? &timeout : NULL)); if (events < 0) Index: src/OFSelectKernelEventObserver.m ================================================================== --- src/OFSelectKernelEventObserver.m +++ src/OFSelectKernelEventObserver.m @@ -25,11 +25,10 @@ /* Win32 has a ridiculous default of 64, even though it supports much more. */ # define FD_SETSIZE 1024 #endif #include -#include #include #include #import "OFSelectKernelEventObserver.h" @@ -178,11 +177,11 @@ #ifndef OF_WINDOWS timeout.tv_sec = (time_t)timeInterval; #else timeout.tv_sec = (long)timeInterval; #endif - timeout.tv_usec = (int)lrint((timeInterval - timeout.tv_sec) * 1000); + timeout.tv_usec = (int)((timeInterval - timeout.tv_sec) * 1000); #ifdef OF_AMIGAOS if ((cancelSignal = AllocSignal(-1)) == (ULONG)-1) @throw [OFObserveFailedException exceptionWithObserver: self errNo: EAGAIN]; Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -84,14 +84,10 @@ #ifdef OF_HAVE_ATOMIC_OPS # import "atomic.h" #endif -#ifdef OF_DJGPP -# define lrint(x) rint(x) -#endif - #if defined(OF_HAVE_THREADS) # import "tlskey.h" # if defined(OF_AMIGAOS) && defined(OF_HAVE_SOCKETS) # import "socket.h" # endif @@ -248,11 +244,11 @@ svcSleepThread((int64_t)(timeInterval * 1000000000)); #elif defined(HAVE_NANOSLEEP) struct timespec rqtp; rqtp.tv_sec = (time_t)timeInterval; - rqtp.tv_nsec = lrint((timeInterval - rqtp.tv_sec) * 1000000000); + rqtp.tv_nsec = (timeInterval - rqtp.tv_sec) * 1000000000; if (rqtp.tv_sec != trunc(timeInterval)) @throw [OFOutOfRangeException exception]; nanosleep(&rqtp, NULL); @@ -273,12 +269,12 @@ #else if (timeInterval > UINT_MAX) @throw [OFOutOfRangeException exception]; sleep((unsigned int)timeInterval); - usleep((unsigned int)lrint( - (timeInterval - trunc(timeInterval)) * 1000000)); + usleep((unsigned int) + (timeInterval - (unsigned int)timeInterval) * 1000000); #endif } + (void)sleepUntilDate: (OFDate *)date { Index: src/condition_pthread.m ================================================================== --- src/condition_pthread.m +++ src/condition_pthread.m @@ -13,12 +13,10 @@ * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ -#include - bool of_condition_new(of_condition_t *condition) { return (pthread_cond_init(condition, NULL) == 0); } @@ -46,15 +44,15 @@ of_time_interval_t timeout) { struct timespec ts; ts.tv_sec = (time_t)timeout; - ts.tv_nsec = lrint((timeout - ts.tv_sec) * 1000000000); + ts.tv_nsec = (timeout - ts.tv_sec) * 1000000000; return (pthread_cond_timedwait(condition, mutex, &ts) == 0); } bool of_condition_free(of_condition_t *condition) { return (pthread_cond_destroy(condition) == 0); }