While porting programs from linux to .Net architecture you could face the gettimeofday function…

The functions gettimeofday(struct timeval *tv, struct timezone *tz) gets the time as well as timezones. The tv argument is a struct timeval and gives the number of seconds and microseconds since the Epoch, the Epoch time is a system for describing instants in time, defined as the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970, not counting leap seconds. It is used widely in Unix-like and many other operating systems and file formats.
The tz argument is a struct timezone, the use of the timezone structure is obsolete; the tz argument should normally be specified as NULL


To get the Epoch Time with .net you can simply use the following statement:

epoch = (DateTime.Now.ToUniversalTime().Ticks – 621355968000000000) / 10000000.0;

The costant 621355968000000000 represents the number of ticks between Jan 1, 0001 and Jan 1, 1970 in UTC.