Index: src/OFDate.m ================================================================== --- src/OFDate.m +++ src/OFDate.m @@ -373,11 +373,11 @@ return element; } - (uint32_t)microsecond { - return nearbyint(remainder(seconds, 1) * 1000000); + return (uint32_t)nearbyint(remainder(seconds, 1) * 1000000); } - (uint8_t)second { GMTIME_RET(tm_sec) Index: src/OFThread.h ================================================================== --- src/OFThread.h +++ src/OFThread.h @@ -164,21 +164,11 @@ * \brief Suspends execution of the current thread for the specified time * interval. * * \param seconds The number of seconds to sleep */ -+ (void)sleepForTimeInterval: (int64_t)seconds; - -/** - * \brief Suspends execution of the current thread for the specified time - * interval. - * - * \param seconds The number of seconds to sleep - * \param microseconds The number of microseconds to sleep - */ -+ (void)sleepForTimeInterval: (int64_t)seconds - microseconds: (uint32_t)microseconds; ++ (void)sleepForTimeInterval: (double)seconds; /** * \brief Suspends execution of the current thread until the specified date. * * \param date The date to wait for Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -156,42 +156,26 @@ + (OFThread*)currentThread { return [[of_tlskey_get(threadSelf) retain] autorelease]; } -+ (void)sleepForTimeInterval: (int64_t)seconds ++ (void)sleepForTimeInterval: (double)seconds { if (seconds < 0) @throw [OFOutOfRangeException newWithClass: self]; #ifndef _WIN32 if (seconds > UINT_MAX) @throw [OFOutOfRangeException newWithClass: self]; sleep((unsigned int)seconds); + usleep((uint32_t)nearbyint(remainder(seconds, 1) * 1000000)); #else if (seconds * 1000 > UINT_MAX) @throw [OFOutOfRangeException newWithClass: self]; - Sleep((unsigned int)seconds * 1000); -#endif -} - -+ (void)sleepForTimeInterval: (int64_t)seconds - microseconds: (uint32_t)microseconds -{ - if (seconds < 0) - @throw [OFOutOfRangeException newWithClass: self]; - -#ifndef _WIN32 - sleep((unsigned int)seconds); - usleep(microseconds); -#else - if (seconds * 1000 + microseconds / 1000 > UINT_MAX) - @throw [OFOutOfRangeException newWithClass: self]; - - Sleep((unsigned int)seconds * 1000 + microseconds / 1000); + Sleep((unsigned int)(seconds * 1000)); #endif } + (void)sleepUntilDate: (OFDate*)date { @@ -200,16 +184,16 @@ #ifndef _WIN32 if (seconds > UINT_MAX) @throw [OFOutOfRangeException newWithClass: self]; sleep((unsigned int)seconds); - usleep(nearbyint(remainder(seconds, 1) * 1000000)); + usleep((uint32_t)nearbyint(remainder(seconds, 1) * 1000000)); #else if (seconds * 1000 > UINT_MAX) @throw [OFOutOfRangeException newWithClass: self]; - Sleep(seconds * 1000); + Sleep((unsigned int)(seconds * 1000)); #endif } + (void)yield {