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.
Check out this NTP client library for iOS: https://code.google.com/p/ios-ntp/
Source: 1
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;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With