Differences From Artifact [9734ed9f86]:
- File src/OFThread.m — part of check-in [49ec1216cd] at 2011-09-21 20:11:38 on branch trunk — More precision for microseconds. (user: js, size: 9673) [annotate] [blame] [check-ins using]
To Artifact [a10047f5e7]:
- File
src/OFThread.m
— part of check-in
[45b499fb11]
at
2011-09-22 02:20:18
on branch trunk
— Use rint() instead of nearbyint().
nearbyint() is missing on some systems, even though it is part of C99
and POSIX. (user: js, size: 9663) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
164 165 166 167 168 169 170 | @throw [OFOutOfRangeException newWithClass: self]; #ifndef _WIN32 if (seconds > UINT_MAX) @throw [OFOutOfRangeException newWithClass: self]; sleep((unsigned int)seconds); | | | | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | @throw [OFOutOfRangeException newWithClass: self]; #ifndef _WIN32 if (seconds > UINT_MAX) @throw [OFOutOfRangeException newWithClass: self]; sleep((unsigned int)seconds); usleep((useconds_t)rint((seconds - floor(seconds)) * 1000000)); #else if (seconds * 1000 > UINT_MAX) @throw [OFOutOfRangeException newWithClass: self]; Sleep((unsigned int)(seconds * 1000)); #endif } + (void)sleepUntilDate: (OFDate*)date { double seconds = [date timeIntervalSinceNow]; #ifndef _WIN32 if (seconds > UINT_MAX) @throw [OFOutOfRangeException newWithClass: self]; sleep((unsigned int)seconds); usleep((useconds_t)rint((seconds - floor(seconds)) * 1000000)); #else if (seconds * 1000 > UINT_MAX) @throw [OFOutOfRangeException newWithClass: self]; Sleep((unsigned int)(seconds * 1000)); #endif } |
︙ | ︙ |