Skip to content

Commit 294290f

Browse files
committed
Ensure the hashing of Duration is based upon the attoseconds hashing
1 parent 6d07868 commit 294290f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

stdlib/public/core/Duration.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,12 @@ extension Duration: Codable {
127127
}
128128

129129
@available(SwiftStdlib 5.7, *)
130-
extension Duration: Hashable { }
130+
extension Duration: Hashable {
131+
@available(SwiftStdlib 5.7, *)
132+
public func hash(into hasher: inout Hasher) {
133+
hasher.combine(_attoseconds)
134+
}
135+
}
131136

132137
@available(SwiftStdlib 5.7, *)
133138
extension Duration: Equatable {

0 commit comments

Comments
 (0)