> On 16 Feb 2017, at 18:58, Saagar Jha wrote:
>
> DispatchTimeInterval.nanoseconds expects an Int, while uptimeNanoseconds is
> an UInt64 (an thus so is their difference). You can “fix” this by adding an
> explicit cast:
Aha! So this was just a confusing compiler
I don't know if you are using an IDE, but in Xcode. I can just cmd+mouse
left click to see the code headers.
Zhaoxin
On Fri, Feb 17, 2017 at 2:22 AM, Jon Shier via swift-users <
swift-users@swift.org> wrote:
> I’ve had good luck with being able to click the candidates in
> cases like
I’ve had good luck with being able to click the candidates in cases
like this so Xcode will navigate to those bits of code. However, in this case I
think the issue is that the candidates weren’t from user code but from the
standard library, which Xcode has all sorts of issues navigating
> As usual the candidates are unknown.
Just on this particular note, this is a terrible presentation issue and totally
something we Apple people need to fix in Xcode, but you can usually see what
the candidates were in the build log.
Jordan
> On Feb 16, 2017, at 07:56, J.E. Schotsman via
DispatchTimeInterval.nanoseconds expects an Int, while uptimeNanoseconds is an
UInt64 (an thus so is their difference). You can “fix” this by adding an
explicit cast:
func -(time1: DispatchTime, time2: DispatchTime) -> DispatchTimeInterval {
return
I don’t know about the candidates
But the uptimeNanoseconds is a UInt64 and as such you should probably use
substractWithOverflow.
var a: UInt64 = 12
var b: UInt64 = 25
let result = UInt64.subtractWithOverflow(a, b)
if result.overflow {
print("Overflow")
} else {
let answer = result.0
Hello,
I am trying to define an operator that subtracts dispatch times:
#import Dispatch
func -( time1: DispatchTime, time2: DispatchTime ) -> DispatchTimeInterval
{
return DispatchTimeInterval.nanoseconds( time2.uptimeNanoseconds -
time1.uptimeNanoseconds )
}
Compiler