title: Why does stat mtime only update twice each second?
body: <p><strong>UPDATE</strong></p>
  
  <p>The following bash commandline seems to show it is not a R problem (play with the sleep to see it will only update at 0.43 and 0.93 past each second). (So I've changed the question tags.)</p>
  
  <pre><code>touch tmp.txt;stat tmp.txt;sleep 0.5;touch tmp.txt;stat tmp.txt
  </code></pre>
  
  <p>However I see "Modify: 2013-06-20 14:28:36.938579054", not "Modify: 2013-06-20 14:28:36", suggesting that my linux kernel is compiled and configured for nanosecond accuracy. So, I'm still a bit stumped why it appears to be an awful long away from nanonsecond accuracy!</p>
  
  <hr>
  
  <p>The below script isolates a problem I discovered in a real script. I'm saving data to the same file, repeatedly. It appears that file.info$mtime only updates twice a second. When I use the 0.05s sleep the problem is quite distinct: <code>file.info</code> does not update 87 or 88 times out of 100. If I increase the sleep to 0.5s it works perfectly (bad==0). If I reduce the sleep to 0.4s it goes wrong 14 times out of 100.</p>
  
  <p>My question is: is this an R bug, or something to do with the O.S.? Or am I doing something wrong, or making a bad assumption?</p>
  
  <p>I'm using R 3.0.1, on Ubuntu 10.04.</p>
  
  <p>BTW, I notice when running the below that the mtime's are always ending at either .936 or .436 (or something very close to those). Never at 0.250, or 0.800, or 0.950, etc.</p>
  
  <p>One more possibly useful data point: I tried doing <code>file.remove</code> each time before calling <code>save</code>. It made no difference.</p>
  
  <pre><code>fname="tmp.rdata"
  options(digits.secs = 3)
  
  data=runif(100)
  save(list=c("data"),file=fname)
  info=file.info(fname)
  
  ix=0;bad=0
  
  while(ix&lt;100){
      Sys.sleep(0.05)
      data=runif(100)
      current=Sys.time()
      save(list=c("data"),file=fname)
      info2=file.info(fname)
      if(info2$mtime&lt;=info$mtime){bad=bad+1;cat("****************\n")}
      print(current);print(rbind(info,info2))
      ix=ix+1;info=info2
      }
  cat("bad=",bad,"\n")
  </code></pre>
  
  <hr>
  
  <p>Here is the output of <code>stat -c "%y" * |sort</code>, for the files from the past two months. So it appears the dates can be anywhere in the second. Yet, for files saved at around the same time they all seem to have the same two values?!</p>
  
  <pre><code>2013-04-16 14:41:50.331227602
  2013-04-19 20:52:50.238225648
  2013-04-30 10:34:43.896278930
  2013-05-02 08:36:39.360523004
  2013-05-02 08:46:07.848039045
  2013-05-07 17:10:19.372043866
  2013-05-07 19:12:00.369502114
  2013-05-07 19:19:11.370293101
  2013-05-07 22:14:39.744755951
  2013-05-07 22:14:58.242163170
  2013-05-24 12:21:06.231306593
  2013-06-06 15:14:40.174142594
  2013-06-10 11:16:31.958667081
  2013-06-10 11:18:29.958090098
  2013-06-10 11:34:16.961026520
  2013-06-12 10:44:12.825080955
  2013-06-14 12:50:49.531729270
  2013-06-17 11:05:23.792289000
  2013-06-18 11:44:40.347221361
  2013-06-19 13:10:46.590013564
  2013-06-20 11:52:16.436423344
  2013-06-20 11:52:24.437938646
  2013-06-20 11:52:24.437938646
  2013-06-20 13:17:16.436666359
  2013-06-20 13:20:50.928713629
  2013-06-20 14:28:36.938579054
  </code></pre>