title: Why SO_RCVTIMEO timeout differs after it was set?
body: <p>I am on Fedora 25. In the following test program I set recv timeout to 12 sec, 12345 microsec with <code>setsockopt</code>. But when I get timeout value with <code>getsockopt</code>, I get slightly different value: 12 sec, 13000 microsec. I expect it to be the same as it was set by <code>setsockopt</code>.</p>
  
  <p>Why it differs ?</p>
  
  <pre><code>[ ~]$ cat sockopt.c
  #include &lt;stdio.h&gt;
  #include &lt;sys/time.h&gt;
  #include &lt;sys/socket.h&gt;
  
  int main()
  {
      int sd = socket(AF_INET, SOCK_STREAM, 0);
      int rc;
      struct timeval tv;
      socklen_t len = sizeof(tv);
  
      tv.tv_sec = 12;
      tv.tv_usec = 12345;
      rc = setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &amp;tv, sizeof(tv));
      if (rc &lt; 0) printf("oops\n");
  
      rc = getsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &amp;tv, &amp;len);
      if (rc &lt; 0) printf("oops\n");
      printf("%ld, %ld\n",  tv.tv_sec, tv.tv_usec);
  }
  [ ~]$ 
  [ ~]$ gcc -Wall sockopt.c
  [ ~]$ 
  [ ~]$ ./a.out 
  12, 13000
  [ ~]$ 
  </code></pre>