Skip to content

Commit bf75580

Browse files
authored
Merge pull request #1618 from lorentey/clock-duration
Amend SE-0329 to add Clock.Duration
2 parents 23e8a65 + c3612c7 commit bf75580

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

proposals/0329-clock-instant-duration.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
* Renamed the `nanoseconds` and `seconds` property of `Duration` to `nanosecondsPortion` and `secondsPortion` to indicate their fractional composition to types like `timespec`
5555
* **v3.1**
5656
* Adjust the portion accessors to one singular `components` based accessor and add an initializer for raw value construction from components.
57+
* **v3.2**
58+
* Add `Duration` as an associated type requirement of `Clock`, so that it can be marked as the primary associated type.
5759

5860
</details>
5961

@@ -117,7 +119,8 @@ The base protocol for defining a clock requires two primitives; a way to wake up
117119

118120
```swift
119121
public protocol Clock: Sendable {
120-
associatedtype Instant: InstantProtocol
122+
associatedtype Duration: DurationProtocol
123+
associatedtype Instant: InstantProtocol where Instant.Duration == Duration
121124

122125
var now: Instant { get }
123126

0 commit comments

Comments
 (0)