Skip to content

Instantly share code, notes, and snippets.

@tion-low
Created May 15, 2019 05:16
Show Gist options
  • Save tion-low/f6ec82ba3348dedd15ff58f7be8cd393 to your computer and use it in GitHub Desktop.
Save tion-low/f6ec82ba3348dedd15ff58f7be8cd393 to your computer and use it in GitHub Desktop.
import UIKit
import AVFoundation
var tb = mach_timebase_info() // イニシャライザ
mach_timebase_info(&tb) // こっちは関数呼び出し
let tsc = mach_absolute_time()
let t = Double(tsc) * Double(tb.numer) / Double(tb.denom) / 1000000000.0
let seconds = AVAudioTime.seconds(forHostTime: tsc)
let cmtime = CMTime(seconds: seconds, preferredTimescale: 1000000000)
print(cmtime)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment