Skip to content

Task.sleep() sleep too long on Windows #72095

Closed
@HeMet

Description

@HeMet

Description

No response

Reproduction

@main
public struct App {
    public static func main() async throws {
        let clock = ContinuousClock.continuous
        let dur = try await clock.measure {
            try await Task.sleep(for: .seconds(0.1))
        }
        print("Slept for: \(dur)")
    }
}

Output:

Slept for: 64.1733749 seconds

Expected behavior

Task sleep for 0.1 second.

Environment

Swift version 5.10-dev (LLVM 7c3b53ecaad54fb, Swift ebaa8c6)
Target: x86_64-unknown-windows-msvc

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ConcurrencуArea → standard library: The `Concurrency` module under the standard library umbrellaWindowsPlatform: WindowsbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.standard libraryArea: Standard library umbrellaswift 5.10timeArea → standard library → Concurrency: Time APIsunexpected behaviorBug: Unexpected behavior or incorrect output

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions