title: Calculating time interval in iOS application
body: <p>I am developing an iOS application for iPod Touch in which my application displays the server time always. I always sync the application time with server time whenever the application comes to foreground by making a web service call to the server. If there is a connectivity loss between my server and client for few hours I wont be able to sync the application time. I read iOS does not support running a timer when the application is in background other than few limited cases mentioned below:</p>
  
  <ul>
  <li>Apps that play audible content to the user while in the background, such as a music player app</li>
  <li>Apps that keep users informed of their location at all times, such as a navigation app</li>
  <li>Apps that support Voice over Internet Protocol (VoIP)</li>
  <li>Newsstand apps that need to download and process new content</li>
  <li>Apps that receive regular updates from external accessories</li>
  </ul>
  
  <p>So how can I keep track of application time? Whenever the user switches to my application he needs to look at the server time so I need to run a timer to update the last synced server time.</p>