Last active
December 23, 2021 01:08
-
-
Save fatso83/86e94e91926d1311f3fa to your computer and use it in GitHub Desktop.
Print the number of millis since the Epoch (Jan 1 1970)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Print the number of millis since the Epoch (Jan 1 1970) | |
* Compile: cc millis.cc -o millis | |
* Put in your path: mv millis /usr/local/bin | |
*/ | |
#include <stdio.h> | |
#include <sys/time.h> | |
int main(void) | |
{ | |
struct timeval time_now; | |
gettimeofday(&time_now,NULL); | |
printf ("%ld%03d\n",time_now.tv_sec,time_now.tv_usec/1000); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment