@@ -173,31 +173,31 @@ + (void)sleepForTimeInterval: (double)seconds { if (seconds < 0) @throw [OFOutOfRangeException exception]; -#if defined(HAVE_NANOSLEEP) +#if defined(_WIN32) + if (seconds * 1000 > UINT_MAX) + @throw [OFOutOfRangeException exception]; + + Sleep((unsigned int)(seconds * 1000)); +#elif defined(HAVE_NANOSLEEP) struct timespec rqtp; rqtp.tv_sec = (time_t)seconds; rqtp.tv_nsec = lrint((seconds - rqtp.tv_sec) * 1000000000); if (rqtp.tv_sec != floor(seconds)) @throw [OFOutOfRangeException exception]; nanosleep(&rqtp, NULL); -#elif !defined(_WIN32) +#else if (seconds > UINT_MAX) @throw [OFOutOfRangeException exception]; sleep((unsigned int)seconds); usleep((useconds_t)lrint((seconds - floor(seconds)) * 1000000)); -#else - if (seconds * 1000 > UINT_MAX) - @throw [OFOutOfRangeException exception]; - - Sleep((unsigned int)(seconds * 1000)); #endif } + (void)sleepUntilDate: (OFDate*)date {