title: How is [NSDate date] calculated?
body: <p>I'm using part of the current date in a scheme on a web server and I want to generate the same value on the device as on the server. In theory I thought about a case where these two values wouldn't be the same and the values on either end wouldn't match.</p>
  
  <p>Which then led me to think - how, <em>specifically</em>, is <code>[NSDate date]</code> calculated when an app is running?</p>
  
  <p><strong>Edit:</strong> I guess what I'm really asking, is <strong>how does an iPhone get its time from an authoritative source?</strong> It appears it comes from a cell tower which I would assume are all synced somehow. Is this true?</p>
  
  <p><strong>Edit:</strong> Looks like it uses gettimeofday() which uses the system clock. And from <a href="http://support.apple.com/kb/ta38641" rel="nofollow">Apple docs</a>, looks like when you have the iPhone set to 'Set Automatically', it uses the correct time over the cell network.</p>
  
  <p>Thanks,</p>