Skip to content

Commit 54b6dde

Browse files
committed
simplify pysleep
1 parent c4ce9cc commit 54b6dde

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

Modules/timemodule.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,18 +2215,9 @@ pysleep(PyTime_t timeout)
22152215
{
22162216
assert(timeout >= 0);
22172217
assert(!PyErr_Occurred());
2218-
#ifndef MS_WINDOWS
22192218
if (timeout == 0) { // gh-125997
22202219
return pysleep_zero();
22212220
}
2222-
#else
2223-
PyTime_t timeout_100ns = _PyTime_As100Nanoseconds(timeout,
2224-
_PyTime_ROUND_CEILING);
2225-
if (timeout_100ns == 0) { // gh-125997
2226-
return pysleep_zero();
2227-
}
2228-
#endif
2229-
22302221
#ifndef MS_WINDOWS
22312222
#ifdef HAVE_CLOCK_NANOSLEEP
22322223
struct timespec timeout_abs;
@@ -2304,6 +2295,9 @@ pysleep(PyTime_t timeout)
23042295

23052296
return 0;
23062297
#else // MS_WINDOWS
2298+
PyTime_t timeout_100ns = _PyTime_As100Nanoseconds(timeout,
2299+
_PyTime_ROUND_CEILING);
2300+
assert(timeout_100ns > 0);
23072301
LARGE_INTEGER relative_timeout;
23082302
// No need to check for integer overflow, both types are signed
23092303
assert(sizeof(relative_timeout) == sizeof(timeout_100ns));

0 commit comments

Comments
 (0)