1#include <sys/time.h>
2
3long long current_timestamp() {
4    struct timeval te; 
5    gettimeofday(&te, NULL); // get current time
6    long long milliseconds = te.tv_sec*1000LL + te.tv_usec/1000; // calculate milliseconds
7    // printf("milliseconds: %lld\n", milliseconds);
8    return milliseconds;
9}