mirror of
https://github.com/averello/Ents.git
synced 2026-03-05 18:23:25 +01:00
21 lines
443 B
Swift
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
|