title: How to generate TSval for TCP Timestamp option, in python?
body: <p>I am trying to implement a receiving side of the TCP protocol via <code>scapy</code>. </p>
  
  <p>I have node <code>A</code> who sends some random json file over TCP to node <code>B</code>, and I am trying to write the receiving side of TCP using <code>scapy</code> for node B. I am sniffing packets in <code>scapy</code> and trying to ACK incoming packets from node <code>B</code>. </p>
  
  <p>I have figured out how to set correct ACK and SEQ numbers for the ACK packets I construct, but I'm struggling with creating correct Timestamp TCP options. I have read in RFC-1323 that Timestamp contains <code>TSval</code> and <code>TSecr</code>. I set <code>TSecr</code> by copying the <code>TSval</code> from the incoming packet, but from what I understand, I need to set <code>TSval</code> to be the current time of the system. I'm not sure how to get the time correctly. I tried doing the following in python</p>
  
  <pre><code>import time
  TSval = int(time.time())
  </code></pre>
  
  <p>But it doesn't give me the correct value because the value of <code>TSecr</code> is something like 3130283869 whereas the above snippet gives me something like 1539307653 (almost 2x smaller). It's not clear to me what kind of time is represented by <code>Tsecr</code> and <code>TSval</code>. Is it epoch time? Is it something else?</p>