Files
Ents-mirror/Ents/Classes/utils/TimedBlock.swift
2019-03-15 09:38:33 +02:00

21 lines
443 B
Swift

//
// TimedBlock.swift
// Ents
//
// Created by Georges Boumis on 26/08/2016.
// Copyright © 2016-2019 Georges Boumis.
// Licensed under MIT (https://github.com/averello/Ents/blob/master/LICENSE)
//
import Foundation
#if canImport(CoreFoundation)
import CoreFoundation
public func TimedBlock(_ block: () throws -> Void) rethrows -> CFTimeInterval {
let chrono = Chronometer()
try block()
return chrono.difference
}
#endif