title: Swift - Cannot invoke initialiser for type dispatch_time_t
body: <p>I've taken over some Swift 2 code and trying to bring it up to Swift 3 (Xcode 8.3), but I'm stuck on one line.</p>
  
  <p>The code is checking to see if a host is connected:</p>
  
  <pre><code>func isHostConnected(hostAddress : String) -&gt; Bool {
      let request = NSMutableURLRequest(url: NSURL(string: hostAddress.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)!)! as URL)
      request.timeoutInterval = 3
      request.httpMethod = "HEAD"
  
      let session = URLSession(configuration: URLSessionConfiguration.default)
      var responseCode = -1
  
      let group = DispatchGroup.init()
      group.enter()
  
      session.dataTask(with: request as URLRequest, completionHandler: {(_, response, _) in
          if let httpResponse = response as? HTTPURLResponse {
              responseCode = httpResponse.statusCode
          }
          group.leave()
      }).resume()
  
      group.wait(timeout: dispatch_time_t(DispatchTime.distantFuture)) //ERROR LINE
      return (responseCode == 401)
  }
  </code></pre>
  
  <p>I am getting an error on the line:</p>
  
  <p><code>group.wait(timeout: dispatch_time_t(DispatchTime.distantFuture))</code></p>
  
  <p>which reads:</p>
  
  <p><code>Cannot invoke initializer for type 'dispatch_time_t' with an argument list of type '(DispatchTime)'</code></p>
  
  <p>So it seems to be looking for an object of type <code>DispatchTime</code> as the parameter but I can't seem to find an answer on Google to match <code>.distantFuture</code></p>
  
  <p>Also, if I try:</p>
  
  <p><code>group.wait(timeout: dispatch_time_t(.distantFuture))</code></p>
  
  <p>I get an error saying:</p>
  
  <p><code>Type of expression is ambiguous without more context</code></p>
  
  <p>Thanks.</p>