want iOS current time in microseconds

I can't find the iOS equivalent of mach_absolute_time that will give me the current time in microseconds -- is there no such thing?

Accepted Reply

Thanx - it turns out I was failing to recognize that a Foundation TimeInterval is a Double. When I posted, I was thinking it was an Int with resolution only to seconds. Since it's a Double, I can multiply by 10**6 and get microseconds. I can just use the regular Foundation Date for this.


let time0 = Int(Date().timeIntervalSince1970 * 1_000_000) & 0xffff_ffff

appSeed0 = time0

Replies

Thanx - it turns out I was failing to recognize that a Foundation TimeInterval is a Double. When I posted, I was thinking it was an Int with resolution only to seconds. Since it's a Double, I can multiply by 10**6 and get microseconds. I can just use the regular Foundation Date for this.


let time0 = Int(Date().timeIntervalSince1970 * 1_000_000) & 0xffff_ffff

appSeed0 = time0