<p>There is an interesting twist when you want to know the Unix Epoch time in .Net on a Windows system.</p>

<p>For nearly all practical cases and assuming the current time is past the Unix Epoch you could indeed take </p>

<pre><code>System.TimeSpan timeDifference = DateTime.UTCNow - 
            new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
long unixEpochTime = System.Convert.ToInt64(timeDifference.TotalSeconds);
</code></pre>

<p>But,</p>

<p>Unix Epoch Time is defined as "... a system for describing points in time, defined as the number of seconds elapsed since midnight Coordinated Universal Time (UTC) of January 1, 1970, <strong>not counting leap seconds</strong>." (1)</p>

<p>Since 1972, UTC has included "leap seconds", and we have had a total of 25 of them so far. (2)</p>

<p>The .Net DateTime has no provisions for Leap Seconds, but will simply rely on the OS time. Windows is blissfully unaware of Leap Seconds (3)(4), and so will just have the notion of time as it receives it from its NTP master (I believe the default for a non-domain connected machine is time.windows.com ), which is probably serving up UTC including leap seconds.</p>

<p>This means that in order to be pedantically correct about the real number of seconds passed since the Unix epoch, you should probably add the leap seconds to the result obtained above for applications that rely on this. You would have to track the number of seconds to add at each time since leap seconds are not announced far in advance (2). However, as the definition of Unix Epoch Time explicitly excludes leap seconds, you can safely ignore this and simply recalculate seconds from the current UTC time. </p>

<p>Sometimes, leap seconds do cause software mayhem (5). The debate over whether to keep or eliminate the practice is ongoing (6)(7)(8). </p>

<p>The last leap second at the time of the answer occurred on the 1st of July 2012 (9) and caused problems for various sites and applications (10)</p>

<p>(1) <a href="http://en.wikipedia.org/wiki/Unix_time" rel="noreferrer">http://en.wikipedia.org/wiki/Unix_time</a></p>

<p>(2) <a href="http://en.wikipedia.org/wiki/Leap_second" rel="noreferrer">http://en.wikipedia.org/wiki/Leap_second</a></p>

<p>(3) <a href="http://support.microsoft.com/kb/909614" rel="noreferrer">http://support.microsoft.com/kb/909614</a></p>

<p>(4) <a href="http://www.meinberg.de/english/info/leap-second.htm" rel="noreferrer">http://www.meinberg.de/english/info/leap-second.htm</a></p>

<p>(5) <a href="http://www.networkworld.com/news/2009/010609-leap-second-snafu-affects-oracle.html" rel="noreferrer">http://www.networkworld.com/news/2009/010609-leap-second-snafu-affects-oracle.html</a></p>

<p>(6) <a href="http://www.pcworld.idg.com.au/article/358024/time_waits_no_one_leap_seconds_may_cut/" rel="noreferrer">http://www.pcworld.idg.com.au/article/358024/time_waits_no_one_leap_seconds_may_cut/</a></p>

<p>(7) <a href="http://queue.acm.org/detail.cfm?id=1967009" rel="noreferrer">http://queue.acm.org/detail.cfm?id=1967009</a></p>

<p>(8) <a href="http://arxiv.org/abs/1106.3141" rel="noreferrer">http://arxiv.org/abs/1106.3141</a></p>

<p>(9) <a href="http://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat" rel="noreferrer">http://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat</a></p>

<p>(10) <a href="http://arstechnica.com/business/2012/07/one-day-later-the-leap-second-v-the-internet-scorecard/" rel="noreferrer">http://arstechnica.com/business/2012/07/one-day-later-the-leap-second-v-the-internet-scorecard/</a></p>

<p>(The original answer had a mistake, which was thankfully caught by the commenters Edward Brey and Mormegil below)</p>
Calculating Future Epoch Time in C#
<p>I was able to find example code to get the current timestamp in Linux Epoch (Seconds since Midnight Jan 1st 1970), however I am having trouble finding an example as to how to calculate what the Epoch will be in the future, say for example 10 minutes from now, so how can I calculate a future time in Linux Epoch?</p>