Skip to content

Amend SE-0329 to add Clock.Duration #1618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion proposals/0329-clock-instant-duration.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
* Renamed the `nanoseconds` and `seconds` property of `Duration` to `nanosecondsPortion` and `secondsPortion` to indicate their fractional composition to types like `timespec`
* **v3.1**
* Adjust the portion accessors to one singular `components` based accessor and add an initializer for raw value construction from components.
* **v3.2**
* Add `Duration` as an associated type requirement of `Clock`, so that it can be marked as the primary associated type.

</details>

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

```swift
public protocol Clock: Sendable {
associatedtype Instant: InstantProtocol
associatedtype Duration: DurationProtocol
associatedtype Instant: InstantProtocol where Instant.Duration == Duration

var now: Instant { get }

Expand Down