Advertisement
Guest User

Untitled

a guest
Jul 29th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. class ViewController: UIViewController {
  2. let netAssociation = NetAssociation(serverName: "time.apple.com")
  3.  
  4. func viewDidLoad() {
  5. super.viewDidLoad()
  6.  
  7. netAssociation.delegate = self
  8. netAssociation.sendTimeQuery()
  9. }
  10.  
  11. func reportFromDelegate() {
  12. let timeOffset = netAssociation.offset
  13.  
  14. // serverTime will always be in UTC. Use an NSDateFormatter
  15. // to display it to your local timezone
  16. let serverTime = NSDate(timeIntervalSince1970: timeOffset)
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement