calculate number ticks from outside of the .net framework
<p>Does anyone know how to calculate the number of .net time ticks from outside of the .net framework? my situation involves a python script on Linux (my side) needing to send a timestamp as the number of ticks in a message destined for a C# process (the other side, who can't change its code). I can't find any libraries that do this... Any thoughts? Thanks! </p>

<p>You can easily determine what the Unix/Linux epoch (1970-01-01 00:00:00) is in DateTime ticks:</p>

<pre><code>DateTime netTime = new DateTime(1970, 1, 1, 0, 0, 0);
Console.WriteLine(netTime.Ticks);
// Prints 621355968000000000
</code></pre>

<p>Since the Unix/Linux timestamp is the number of seconds since 1970-01-01 00:00:00, you can convert that to 100ns ticks by multiplying it by <code>10000000</code>, and then convert it to DateTime ticks by adding <code>621355968000000000</code>:</p>

<pre><code>long netTicks = 621355968000000000L + 10000000L * linuxTimestamp;
</code></pre>

c# python .net timestamp