 
     // If the notice has a finite duration we schedule a dismiss callback
     if let duration = notice.duration {
-      let when = DispatchTime.now() + Double(Int64(duration * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)
-      DispatchQueue.main.asyncAfter(deadline: when) { [weak self] in
+      DispatchQueue.main.asyncAfter(deadline: .now() + duration) { [weak self] in
         // only dismiss when we it's the same notice
         if self?.current?.view === view {
           self?.dismissCurrentNotice()

        }
      }

    }
    else {
      showImmediately(notice: notice, animated: animated)
    }
  }


      CATransaction.setCompletionBlock(complete)
      let animation = CABasicAnimation(keyPath: "transform.translation.y")
      animation.duration = 0.25
      animation.fromValue = 0
      animation.toValue = notice.position == .top ? -view.frame.size.height : +view.frame.size.height

      view.layer.add(animation, forKey: "slide out")
      CATransaction.commit()
