# \[Pitch (back from revision)\] Clock, Instant, and Duration

**URL:** <https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035>\
**Category:** Pitches\
**Created:** [December 13, 2021, 9:22pm UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035 "2021-12-13T21:22:21Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Philippe\_Hausler](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/philippe_hausler/32/22569_2.png) [@Philippe\_Hausler](https://forums.swift.org/u/Philippe_Hausler)\
**Post date:** [December 13, 2021, 9:22pm UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/1 "2021-12-13T21:22:21Z")

</div>

Howdy y'all; it is that time again, to talk about time.

We gathered a lot of great feedback and after sifting through it, weighing the pros and cons, and some prototyping, we have revised the proposal for Clock, Instant, and Duration.

This proposals' main aim remains the same: to provide a set of types to express scheduling work via temporal control. `Clock`, `Instant`, and `Duration` will remain nearly the same; but per issues that have been brought up we will no longer be lowering `Date`.

`Clock` itself remains mostly the same except one small, but important, addition that was brought up to me in private during the review - and we tend to agree that this is a pretty important feature that was missing for power efficiency. That feature is tolerance. For repeated calls, the tolerance can allow for kernel level scheduling of wake-ups with a grace period of how accurate the sleep needs to be. Which in turn, when it is supported, the clock itself can offer a way to express from the caller to say; this is a very important sleep to be accurate upon, or it is a sleep that can have some level of drift to ensure coalesced wake-ups happen. This parameter will be optional. In the concrete clocks we are providing it will be nil by default (a dealers choice style parameter that the underlying implementation may decide on numerous factors for what type of reasonable tolerance can be applied).

Next up is `Instant`. It was brought up that some `Instant` types may need to express duration differently than just an integral time. Notable examples of this are things like clocks based on a GPU where the duration is frames, or a clock based on media where the duration is a rational. These are useful concepts that we should have the flexibility to handle while still retaining the ease of use for common integral values. After prototyping this, we feel that we have meet that balance while preserving the ergonomics that having just a shared concrete duration type serves.

Finally; `Duration` this type has not changed, except two points. It now adopts a `DurationProtocol` which is the constraint for the associated type on `Instant`. Additionally the static methods for calculating hours and minutes are removed (again).

The response was quite robust with regards to `Date` and `WallClock` - there were definitely some rough edges. Specifically the name `Date` was not felt that it was appropriate to lower since it can cause confusion between a computational storage date and a human calendrical date. We heard this and we understand the objection. Ultimately we decided that it is best to leave `Date` in the contextual frame of the home of calendrical APIs; Foundation. While looking at it from the frame of reference of Foundation, the name is reasonable when considering the material history of that type. It makes sense after getting over potential issues with regards to how it is a type devoid of timezone and calendar. `Date` is intended to be used with `Calendar` and we concur that moving, renaming, or altering the storage of `Date` is not ideal. The primary driver for this issue is that of serialization. To alter the serialization method we would need to change considerably more, at considerably more risk, than what we think is reasonable for inflicting on Swift. That all being said; there is still a use case for a clock that has a type that can interface with calendrical systems. Scheduling a task to be woken up at 4PM tomorrow is perfectly reasonable and useful. We feel the discussion of `Date` and and a clock that uses it is an integral part of this proposal; so included in the altered proposal is a section devoted to a new type, `UTCClock`, in Foundation. Directly related to the feedback with regards to `Date`; one major omission of the Foundation (and Darwin) APIs is a way of determining historical leap seconds - I definitely invite folks who have raised concerns about the accounting of leap seconds to weigh in.

Last but not least; we felt that the names of the concrete clocks previously proposed were quite opinionated with a bias to Darwin nomenclature. The names on Darwin for C APIs (as well as other BSD like platforms) take the meaning of "monotonic" as continuously increasing even during sleep of the machine, and "uptime" to be suspending increases while the machine is asleep. Whereas the names on Linux based operating systems are exactly the opposite. We feel that names describing the behavior are much more appropriate for a language that is being developed to be cross platform than picking names from precedent of other APIs. We have renamed `MonotonicClock` to be `ContinuousClock` and the `UptimeClock` to be `SuspendingClock`. To this end we have included some of the alternatives we have considered during this renaming process to aide the discussion by giving some clarity on why we picked what we did.

Since the proposal exceeds the length of posts (perhaps I am a bit too wordy) the most recent revision can be found [here](https://github.com/apple/swift-evolution/blob/e5cdfebdbaa576e4bc0b509cef9e4a277ece841f/proposals/0329-clock-instant-date-duration.md).

---

<div class="post-metadata">

**Author:** ![davedelong](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/davedelong/32/38708_2.png) [@davedelong](https://forums.swift.org/u/davedelong)\
**Post date:** [December 13, 2021, 10:59pm UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/2 "2021-12-13T22:59:40Z")

</div>

Hey Philippe!

I'll cut right to the chase: I **_love_** these changes. This is looking really good and if it were merged as-is, I'd be content.

What comments I do have are very minor ones that I don't consider blocking in any way:

1. The proposal has the associatedtype `Interval`, which conforms to `DurationProtocol`, and a concrete `Duration` type that is used as an `Interval`. I find the naming duality a little hard to follow sometimes, especially because I sometimes gloss over `Interval` and mentally read it as `Instant` and then get confused. I think overall your rationale for choosing the names you did is correct, so I don't really have a better suggestion right now. Just the observation that there's some friction there.
2. I understand the choice about `UTCClock` existing in Foundation so it can take advantage of `Date` (and thank you for keeping that in Foundation!). I do think it's a bit unfortunate that we'll need Foundation to get the device's wall clock, since not every user of the standard library will be able to import Foundation. Is there something that could be done about having that in the standard library, but Foundation adds extensions to its `Instant` type (as with the other instant types) to make it easily translatable to `Date`?

These comments are relatively minor ones. I really appreciate the time and thoughtfulness you've put into this, and especially that you (and everyone you're working with) have heard and incorporated the feedback presented here. 😃

---

<div class="post-metadata">

**Author:** ![michelf](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/michelf/32/1180_2.png) [@michelf](https://forums.swift.org/u/michelf)\
**Post date:** [December 14, 2021, 12:33am UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/3 "2021-12-14T00:33:58Z")

</div>

So many improvements; the only thing I can complain about now is the whole detailed design is still a single giant Prior Art section (according to the heading levels). 😉

---

<div class="post-metadata">

**Author:** ![Philippe\_Hausler](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/philippe_hausler/32/22569_2.png) [@Philippe\_Hausler](https://forums.swift.org/u/Philippe_Hausler)\
**Post date:** [December 14, 2021, 12:56am UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/4 "2021-12-14T00:56:03Z")

</div>

heh, yea that probably can be altered in the heading levels - along with some other house-keeping I will adjust that.

---

<div class="post-metadata">

**Author:** ![Philippe\_Hausler](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/philippe_hausler/32/22569_2.png) [@Philippe\_Hausler](https://forums.swift.org/u/Philippe_Hausler)\
**Post date:** [December 14, 2021, 1:03am UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/5 "2021-12-14T01:03:12Z")

</div>

Updated the proposal with some minor grammar fixes, some clarity refinements, and some better section delineation; non-functional changes.

---

<div class="post-metadata">

**Author:** ![scanon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/scanon/32/2445_2.png) [@scanon](https://forums.swift.org/u/scanon)\
**Post date:** [December 14, 2021, 2:25am UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/6 "2021-12-14T02:25:30Z")

</div>

Generally I'm quite positive on this.

Something about `DurationProtocol` is deeply weird, though--it has nothing to do with durations. The actual protocol requirements essentially make it describe an Archimedean group viewed as a module over the integers (which is isomorphic to a subgroup of the real numbers), and equipped with a few weird division operations. This is both an oddly specific thing to give a stdlib protocol name to, and also a very general thing to use the name `DurationProtocol` for. I believe that some refinement is necessary here either in the form of narrowing down the protocol requirements to what is actually essential, choosing a more suitable name, or both.

I _think_ that the correct resolution here is to split the protocol into a couple pieces that cover more common abstractions--one is the notion of a module or vector space where you can add, subtract, and multiply by a scalar, another is comparable, and I'm not totally sure how the division operations should fit in--and then use their intersection as the generic constraint. I'm open to other ideas, though.

I'm also a little bit wary of using `*` and `/` for the heterogeneous multiply-by-scalar and inverse, because experience has shown that this can lead to somewhat surprising type inference behavior, especially if any `ExpressibleByXLiteral` conformances get involved. I _think_ I would prefer to reserve those for homogeneous operations, at least in the standard library.

This is a lot of little details for one specific piece of the pitch, but overall I think that it's a strong proposal, and I am confident that we can work these out.

---

<div class="post-metadata">

**Author:** ![jrose](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jrose/32/408_2.png) [@jrose](https://forums.swift.org/u/jrose)\
**Post date:** [December 14, 2021, 4:31am UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/7 "2021-12-14T04:31:14Z")

</div>

I'm going to push for allowing heterogeneous `*`, from experience using Rust's Duration type. It's extremely common, especially when writing tests, to multiply a Duration by a constant. And then once you have `*` with a scalar it's weird _not_ to have `/` as an inverse-of-sorts. I'm not so worried about literals because most Durations would not be expressible by literals anyway; it's always better to specify units unless it _is_ something like "number of frames". That's specific to Durations, though, not vector spaces in general.

This might suggest that "vector space" deserves its own protocol, but DurationProtocol would still be the one that introduces the operators.

---

<div class="post-metadata">

**Author:** ![Philippe\_Hausler](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/philippe_hausler/32/22569_2.png) [@Philippe\_Hausler](https://forums.swift.org/u/Philippe_Hausler)\
**Post date:** [December 14, 2021, 6:56am UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/8 "2021-12-14T06:56:54Z")

</div>

The ending signature of `DurationProtocol` is a bit weird I will grant that. The reasoning is that those requirements are there to ensure the fast paths for calculating certain durations are there; namely of which the slop calculations for timers. If we omit those paths then the duration types don't even really need a protocol they can just be a requirement on `Instant.Interval` to be `Comparable`, `AdditiveArithmetic`, and `Sendable`.

If it really just seems too outlandish to have the duration protocol like this then we must find a way to ensure a loop calculating an effective multiplication is reasonably performant to account for the slop/drift/tolerance calculations.

The other algorithm that I know will need these requirements is a backoff calculation. Again the multiplication can be done via looping addition I guess...

Another (not fully convinced it is a good idea) is a "homing-in" style sleep; so given a specific target, sleep half, then sleep the remaining half etc until you are close. This one might be hard without division.

So the change would be this:

```swift
public protocol InstantProtocol: Comparable, Hashable, Sendable {
  associatedtype Interval: Comparable, AdditiveArithmetic, Sendable
  func advanced(by duration: Interval) -> Self
  func duration(to other: Self) -> Interval
}

```

and a flat out removal of `DurationProtocol`.

---

<div class="post-metadata">

**Author:** ![ktraunmueller](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ktraunmueller/32/46137_2.png) [@ktraunmueller](https://forums.swift.org/u/ktraunmueller)\
**Post date:** [December 14, 2021, 7:42am UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/9 "2021-12-14T07:42:45Z")

</div>

Just a tiny bit of naming that struck me as slightly odd, but this may be a matter of personal preference.

The associated type for the `Clock` protocol is called `Instant`, constrained to `InstantProtocol`:

```swift
public protocol Clock: Sendable {
  associatedtype Instant: InstantProtocol
  
  var now: Instant { get }

```

The associated type for `InstantProtocol` is called `Interval`, constrained to `DurationProtocol`:

```swift
public protocol InstantProtocol: Comparable, Hashable, Sendable {
  associatedtype Interval: DurationProtocol
  func advanced(by duration: Interval) -> Self
  func duration(to other: Self) -> Interval
}

```

I would have expected something more like

```swift
public protocol InstantProtocol: Comparable, Hashable, Sendable {
  associatedtype Duration: DurationProtocol
  func advanced(by duration: Duration) -> Self
  func duration(to other: Self) -> Duration
}

```

_Edit: oh, I see, this would clash with `struct Duration`._

Also, I'm a bit confused by the use of the `Protocol` suffix: some protocols are denoted by a `Protocol` suffix (e.g., `DurationProtocol`, `InstantProtocol`), while others aren't (e.g., `Clock`). Is there some general rules behind these naming decisions, or is it just this proposal? Sorry if this has been answered already in the pitch thread.

---

<div class="post-metadata">

**Author:** ![Avi](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/avi/32/2962_2.png) [@Avi](https://forums.swift.org/u/Avi)\
**Post date:** [December 14, 2021, 8:35am UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/10 "2021-12-14T08:35:29Z")

</div>

> [@ktraunmueller](#):
>
> Also, I'm a bit confused by the use of the `Protocol` suffix

I think it has to do with wanting the bare name for a type (Instant, Duration), and not being able to overload the name. There will be no concrete implementation of the Clock protocol provided by the stdlib named "Clock", so there's no need for the "Protocol" suffix.

---

<div class="post-metadata">

**Author:** ![scanon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/scanon/32/2445_2.png) [@scanon](https://forums.swift.org/u/scanon)\
**Post date:** [December 14, 2021, 2:30pm UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/11 "2021-12-14T14:30:34Z")

</div>

> [@jrose](#):
>
> I'm going to push for allowing heterogeneous `*` , from experience using Rust's Duration type. It's extremely common, especially when writing tests, to multiply a Duration by a constant. And then once you have `*` with a scalar it's weird _not_ to have `/` as an inverse-of-sorts.

To be clear, I'm not arguing that they shouldn't exist, but rather it's possible that they shouldn't be spelled `*` and `/` on a VectorSpace/Module-like protocol. The problem isn't with Duration, but rather with _other_ types that one would like to conform to such a protocol, especially complex and quaternions (which are vector spaces over the reals) and Gaussian integers (which are a module over the integers). For these types, it's natural for both the base field/ring (the reals or integers) and the vector space to have the same literal type, which makes expressions like `2 * z` ambiguous. In some sense, this ambiguity isn't a problem, because it doesn't matter--the whole reason why it makes sense to have the vector space be expressible by a scalar literal in these cases is that mathematically the two interpretations are equivalent. But we don't (currently?) have the language tools to communicate that to the compiler.

> [@jrose](#):
>
> This might suggest that "vector space" deserves its own protocol, but DurationProtocol would still be the one that introduces the operators.

This seems like a reasonable resolution.

---

<div class="post-metadata">

**Author:** ![davedelong](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/davedelong/32/38708_2.png) [@davedelong](https://forums.swift.org/u/davedelong)\
**Post date:** [December 14, 2021, 4:06pm UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/12 "2021-12-14T16:06:06Z")

</div>

> [@Philippe\_Hausler](#):
>
> Another (not fully convinced it is a good idea) is a "homing-in" style sleep; so given a specific target, sleep half, then sleep the remaining half etc until you are close.

"[Zeno's Algorithm](https://en.wikipedia.org/wiki/Zeno%27s_paradoxes#Dichotomy_paradox)"

---

<div class="post-metadata">

**Author:** ![Philippe\_Hausler](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/philippe_hausler/32/22569_2.png) [@Philippe\_Hausler](https://forums.swift.org/u/Philippe_Hausler)\
**Post date:** [December 14, 2021, 7:02pm UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/13 "2021-12-14T19:02:56Z")

</div>

I’ve used zenos algorithm for high accuracy sleep via other systems but is it even wise for async/await? That is the open question.

---

<div class="post-metadata">

**Author:** ![sveinhal](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sveinhal/32/3992_2.png) [@sveinhal](https://forums.swift.org/u/sveinhal)\
**Post date:** [December 15, 2021, 1:11pm UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/14 "2021-12-15T13:11:45Z")

</div>

> [@ktraunmueller](#):
>
> I would have expected something more like
> 
> ```swift
> public protocol InstantProtocol: Comparable, Hashable, Sendable {
> associatedtype Duration: DurationProtocol
> func advanced(by duration: Duration) -> Self
> func duration(to other: Self) -> Duration
> }
> 
> ```
> 
> _Edit: oh, I see, this would clash with `struct Duration` ._

Would it, thought? Couldn't some clock's `Instant` just declare `public typealias Duration = Swift.Duration`?

I can't see a lot of examples of when this would clash in practice, and the somewhat extranous `Swift.` prefix would be constrained to that single type alias declaration, which is a very small burden on library authors, which wouldn't surface to end user.

Or am I missing something?

---

<div class="post-metadata">

**Author:** ![Philippe\_Hausler](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/philippe_hausler/32/22569_2.png) [@Philippe\_Hausler](https://forums.swift.org/u/Philippe_Hausler)\
**Post date:** [December 15, 2021, 4:42pm UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/15 "2021-12-15T16:42:14Z")

</div>

The reasoning for the name being `Interval` was that it is probably pretty common for implementors of clocks to use `Duration` as the `Interval` type. It would then mean that developers would immediately get some potentially confusing errors. I am not sure `type alias Duration = Swift.Duration` is immediately obvious of a solution to use that. Whereas writing `func advanced(by duration: Duration) -> MyInstant` is pretty straightforward.

---

<div class="post-metadata">

**Author:** ![sveinhal](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sveinhal/32/3992_2.png) [@sveinhal](https://forums.swift.org/u/sveinhal)\
**Post date:** [December 15, 2021, 5:00pm UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/16 "2021-12-15T17:00:53Z")

</div>

Sure :-)

---

<div class="post-metadata">

**Author:** ![Philippe\_Hausler](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/philippe_hausler/32/22569_2.png) [@Philippe\_Hausler](https://forums.swift.org/u/Philippe_Hausler)\
**Post date:** [December 17, 2021, 5:05pm UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/17 "2021-12-17T17:05:56Z")

</div>

For those interested, I have re-opened a new PR w/ some of the changes associated with this pitch: [Clock/Instant/Duration by phausler · Pull Request #40609 · apple/swift · GitHub](https://github.com/apple/swift/pull/40609)

It is not yet complete; I need to implement the cooperative executor and adjust a few things that are internal implementation details with the dispatch side of things.

---

<div class="post-metadata">

**Author:** ![Philippe\_Hausler](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/philippe_hausler/32/22569_2.png) [@Philippe\_Hausler](https://forums.swift.org/u/Philippe_Hausler)\
**Post date:** [December 17, 2021, 5:13pm UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/18 "2021-12-17T17:13:51Z")

</div>

> [@ktraunmueller](#):
>
> ```swift
> public protocol InstantProtocol: Comparable, Hashable, Sendable {
> associatedtype Duration: DurationProtocol
> func advanced(by duration: Duration) -> Self
> func duration(to other: Self) -> Duration
> }
> 
> ```

So I have been looking into this because the naming discontinuity does bug me a bit too.  
Doing so does not harm the general use of clocks; which quite honestly will be a VERY high majority of the code that will touch this stuff. The few cases where it will matter are the cases where someone is implementing a clock. It does make the implementation of clocks a touch more obtuse, but that difficulty is traded off by making the names line up nicer.

In short: if folks feel strongly about this - it is a tradeoff that we are willing to make.

---

<div class="post-metadata">

**Author:** ![xwu](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/32.png) [@xwu](https://forums.swift.org/u/xwu)\
**Post date:** [December 20, 2021, 6:11am UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/19 "2021-12-20T06:11:17Z")

</div>

Hi @Philippe_Hausler!

This is absolutely fantastic. I've let some time go by after reading the document once, and on second reading it's even better! I agree with @davedelong that the changes overall strengthen the final design significantly.

A few questions and points of feedback:

I agree with others that the `Interval` versus `Duration` terminology is weird. Additionally—and I don't think this has been mentioned—recall that in earlier versions of Swift `Interval` was a standard library type that got coalesced into `Range`: it would be nice not to resurrect that name for something that's totally different.

_If_ another word would be useful for the `associatedtype`, might I suggest `TimeSpan`, which is obviously time-related unlike `Interval`.

However, I think it's quite fine not to use two different words: indeed, the standard library `ExpressibleBy*` types define associated types that have the same name as global type aliases (e.g., `StringLiteralType` is an associated type of `ExpressibleByStringLiteral` and also a global type alias).

* * *

I agree with @scanon re the weirdness of the `DurationProtocol`: if it's not needed, that would be fantastic.

I also have some questions regarding the operators it (and the concrete type `Duration`) exposes, which center around this: is there an implementation reason that multiplication by arbitrary integer types is a requirement, while division of two conforming types produces a `Double` result? It would seem logical that multiplication would be by `Double` values also (which as you know can represent all consecutive integers exactly up to `2 ** 53`, and which I notice the concrete `Duration` type supports)... Do the integer overloads have to do with what you were referring to in your reply about "ensur[ing] fast paths for calculating certain durations"?

* * *

I think I understand the usefulness of the newly pitched `minimumResolution` API. Two minor points about the name:

- First, I think there are two subtly different interpretations a user could have: either (1) "great! this clock _guarantees_ that it's at least that accurate"; or (2) "oh! I shouldn't expect two points in time less than that to be distinguishable." Maybe I'm confusing myself and these two are essentially the same statement, but I _think_ this is boiling down to _accuracy_ versus _precision_, and I'm not exactly sure which one we're trying to represent here and whether there is a common term-of-art in computer timekeeping for it other than "resolution." The proposal also uses the term "granularity" to describe the API—I wonder if there's way to clarify this not only through the explanatory text but in the name of the property itself.
- The standard library, usually eschewing abbreviations, has adopted `min` and `max` as the spelling of "minimum" and "maximum" throughout, with the sole exception of the floating-point IEEE "minimum" and "maximum" operations that are deliberately named distinctly from `Swift.min` since they handle NaN values differently. Even if we stick to the term "resolution," the API would be more consistently named `minResolution`.

* * *

I agree with @davedelong that it's (only a bit) unfortunate that we'd not have a standard library wall clock. I think the revised approach of _not_ putting it in the standard library makes a _lot_ of sense when interfacing with an unchanged `Foundation.Date` type is essential, while still allowing for use with these modern non-calendrical APIs via conformance to `ClockProtocol`. Overall, I like this approach very much so long as we don't close the door to something like the approach which `swift-system` takes with `FilePath` with a potentially separate system clock project (obviously without necessarily committing to such an approach)—based on what I'm seeing in the proposal, there shouldn't be any barriers to third-party libraries tackling this space, correct?

---

<div class="post-metadata">

**Author:** ![Saklad5](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@Saklad5](https://forums.swift.org/u/Saklad5)\
**Post date:** [December 20, 2021, 5:04pm UTC](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035/20 "2021-12-20T17:04:37Z")

</div>

> [@xwu](#):
>
> Overall, I like this approach very much so long as we don't close the door to something like the approach which `swift-system` takes with `FilePath` with a potentially separate system clock project (obviously without necessarily committing to such an approach)—based on what I'm seeing in the proposal, there shouldn't be any barriers to third-party libraries tackling this space, correct?

I am very much in favor of shifting responsibility to new packages rather than Foundation. Foundation is way too monolithic, and it is extremely difficult to tell whether code uses platform-specific behavior from it.

[Next page](https://forums.swift.org/t/pitch-back-from-revision-clock-instant-and-duration/54035.md?page=2)
