Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ViewController: UIViewController {
- let netAssociation = NetAssociation(serverName: "time.apple.com")
- func viewDidLoad() {
- super.viewDidLoad()
- netAssociation.delegate = self
- netAssociation.sendTimeQuery()
- }
- func reportFromDelegate() {
- let timeOffset = netAssociation.offset
- // serverTime will always be in UTC. Use an NSDateFormatter
- // to display it to your local timezone
- let serverTime = NSDate(timeIntervalSince1970: timeOffset)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement