/* helloworld.c: A program to show the time since the Epoch */ #include #include "config.h" #ifdef HAVE_SYS_TIME_H #include #else #include #endif double get_sec_since_epoch() { double sec; #ifdef HAVE_GETTIMEOFDAY struct timeval tv; 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("hello, world! epoch is: "); printf("%f\n", get_sec_since_epoch()); return 0; }