<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><br class=""></div></div><div><blockquote type="cite" class=""><div class="">On Jul 13, 2016, at 9:18 , Karl via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">nuances about the clock (basically, whether or not it pauses during system sleep) are edge-cases which can be handled for the majority of users with a sensible default value</div></div></blockquote><div><br class=""></div>I’m going to stay out of the naming part of the conversation for the moment and just address this point…</div><div><br class=""></div><div>I disagree strenuously: it’s a super important distinction that is frequently the cause of subtle but bad bugs!</div><div><br class=""></div><div>Lets start with the fact that you (presumably not the novice user you describe below) actually got the difference between the two clocks wrong. &nbsp;Here’s the current behavior (on Darwin, not sure what Linux currently implements):</div><div><br class=""></div><div>&nbsp; - DispatchTime is a clock that only advances forward and tracks the amount of time the computer is awake.</div><div><br class=""></div><div>&nbsp; - DispatchWillTime is a clock that tracks as a UTC clock would, generally moving ahead during sleep, but is *not* monotonic. &nbsp;It can move forward, backward, upside down, whatever it wants. &nbsp;And frequently it will.</div><div><br class=""></div><div>And this stuff is hard: if you are writing a tea timer app and you pick either of these, you have a bug. &nbsp;DispatchTime, the bug is that if the user locks their device and it falls asleep the alarm won’t fire upon wake. &nbsp;DispatchWallTime, if the device realizes its clock is ahead or behind the “real” time the elapsed duration won’t be what you expect. &nbsp;(Should we have a third that works for the tea timer? Absolutely…)</div><div><br class=""></div><div>So, what’s the sensible default you had in mind that won’t fail for a large portion of use cases? &nbsp;Safety is an important design point in an API surface and making these distinctions clear to developers is absolutely critical to achieving that goal.</div><div><br class=""></div><div>(Of course, Foundation.Timer gets all of the above horribly wrong, IMHO. &nbsp;We should fix that too…)</div><div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div class="">&nbsp;(the monotonic and walltime clocks are actually split at the type level)<br class=""></div></div></blockquote><div><br class=""></div><div>DispatchTime is not a monotonic clock. &nbsp;At least, not in the POSIX sense. &nbsp;So let’s not call it that. &nbsp;(Linux’s failure to implement POSIX correctly notwithstanding.)</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">Novice users are not going to understand what’s going on here - I expect most of them to default to the more generic-sounding “DispatchTime” without any idea of the implications of this.</div></div></blockquote><div><br class=""></div><div>If that’s the case, that’s a good argument for forcing users to make the choice in an even more obvious and explicit way. &nbsp;Not making it easier to use one or the other when they’ll likely get it wrong.</div><div><br class=""></div><div><div class=""><span style="font-family: HelveticaNeue-Light; orphans: 2; widows: 2;" class="">~ Anthony</span></div></div></div></body></html>