title: How to get last modified time of a file in OS X/ C?
body: <p>I have the following code:</p>
  
  <pre><code>struct stat info;
  stat("/Users/john/test.txt", &amp;info);
  printf("%s\n", ctime(&amp;info.st_mtimespec));
  </code></pre>
  
  <p>in which I am trying to get the last modified time of the file as displayed in the <code>ls -l</code> command in the format: </p>
  
  <pre><code>Jan 29 19:39
  </code></pre>
  
  <p>Unfortunately, above code doesn't work.I get the following error message on xcode:</p>
  
  <pre><code>Conflicting types for ctime
  </code></pre>
  
  <p>How can I fix it ? If there any alternative approaches to get the time in format mentioned, please do mention. </p>