Get the current time in milliseconds
/*
Example: get current time in milliseconds in C language
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
int main(void) {
struct timeval te;
// Get the current time
gettimeofday(&te, NULL);
// convert into milliseconds
long long milliseconds = te.tv_sec*1000LL + te.tv_usec/1000;
printf("milliseconds: %lld\n", milliseconds);
return 0;
}