git.fiddlerwoaroof.com
hello.c
e993f970
 #include <stdio.h>
a2d76f89
 #include <sys/time.h>
1622dd8b
 #include "config.h"
e993f970
 
1622dd8b
 #ifdef HAVE_SYS_TIME_H
     #include <sys/time.h>
 #else
     #include <time.h>
 #endif
 
 double get_sec_since_epoch()
e993f970
 {
a2d76f89
     double sec;
 
1622dd8b
     #ifdef HAVE_GETTIMEOFDAY
         struct timeval tv;
a2d76f89
 
1622dd8b
         gettimeofday(&tv, NULL);
         sec = tv.tv_sec;
         sec += tv.tv_usec / 1000000.0;
     #else
         sec = time(NULL);
     #endif
 
     return sec;
 }
 
 int main(int argc, char* argv[])
 {
     printf("%f\n", get_sec_since_epoch());
e993f970
 
     return 0;
 }