/* gettime.c * * Neal Nelson 2009.10.15 * * gettimeofday */ #include #include #include main() { struct timeval tv; gettimeofday(&tv,NULL); printf("%d seconds and %d microseconds since Jan 1, 1970\n", tv.tv_sec, tv.tv_usec); /* Time in a readable format */ printf("...Meaning, it is now: %s\n", ctime(&(tv.tv_sec))); }