8000 Use Windows epoch on Windows · python/cpython@dc1824b · GitHub
[go: up one dir, main page]

Skip to content

Commit dc1824b

Browse files
committed
Use Windows epoch on Windows
1 parent 01ced2d commit dc1824b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Modules/timemodule.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2273,7 +2273,9 @@ pysleep(_PyTime_t timeout, int absolute)
22732273
// No need to check for integer overflow, both types are signed
22742274
assert(sizeof(due_time) == sizeof(timeout_100ns));
22752275
if (absolute) {
2276-
due_time.QuadPart = timeout_100ns;
2276+
// Adjust from Unix time (1970-01-01) to Windows time (1601-01-01)
2277+
// (the inverse of what is done in py_get_system_clock)
2278+
due_time.QuadPart = timeout_100ns + 116444736000000000;
22772279
}
22782280
else {
22792281
// SetWaitableTimer(): a negative due time indicates relative time

0 commit comments

Comments
 (0)
0