There is this example code, but then it starts talking about millisecond / nanosecond problems.
The same question is on MSDN, Seconds since the Unix epoch in C#<
System.DateTimeOffset.Now.ToUnixTimeSeconds()