I wish to know if there is any way to find next minute UTC time without using internet connection. I have to perform an action (play song at a time on multiple devices without lag) at a given point of time.
Asked
Active
Viewed 106 times
2
-
might be helpful http://stackoverflow.com/questions/761791/converting-between-local-times-and-gmt-utc-in-c-c – Maulik Sep 30 '13 at 09:19
-
Failed,,, Cause crash – Sundeep Saluja Sep 30 '13 at 09:51
-
There is no guarantee the time will be the same on two different devices, so you will run into problems if you are trying to sync something based on system time alone. – lxt Sep 30 '13 at 11:01
-
So is there any way to achieve this>?? – Sundeep Saluja Sep 30 '13 at 11:20
1 Answers
0
Since NSDate is always in UTC, you could:
NSDateComponents *minuteComponent = [[NSDateComponents alloc] init];
minuteComponent.minute = 1;
NSCalendar *theCalendar = [NSCalendar currentCalendar];
NSDate *nextMinuteDate = [theCalendar dateByAddingComponents:minuteComponent toDate:[NSDate date] options:0];
NSLog(@"%@",nextMinuteDate);
-
It did nt help,, If system date is different then it will give different results... :( – Sundeep Saluja Sep 30 '13 at 11:19
-
1There is no physical possible way to perform a synchronised action with wrong dates and no internet connection. You should rethink this part of your app. – mmackh Sep 30 '13 at 11:26