Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accurate time on iPhone

Is there an way to get a time very precisely in iPhone.? Currently i am trying with the ios NTp client Here . I am getting almost 600 milliseconds difference while comparing with different divices . Even i am not worrying about the accurate time like ntp , I want to show same time with milliseconds in different devices.

like image 954
Sat Avatar asked Mar 13 '26 18:03

Sat


2 Answers

Check out this NTP client library for iOS: https://code.google.com/p/ios-ntp/

Source: 1

like image 112
maroux Avatar answered Mar 15 '26 08:03

maroux


This is simple way to do this go through it :-

 + (NSDate *) GMTNow
 { 
  NSDate *sourceDate = [NSDate date];
  NSTimeZone* currentTimeZone = [NSTimeZone localTimeZone];
  NSInteger currentGMTOffset = [currentTimeZone secondsFromGMT];

  [sourceDate dateByAddingTimeInterval:currentGMTOffset];

  return sourceDate;
  }
like image 37
Arpit Kulsreshtha Avatar answered Mar 15 '26 08:03

Arpit Kulsreshtha