solo/time.c
2018-04-28 21:40:13 -04:00

11 lines
252 B
C

#include <sys/time.h>
#include <stdint.h>
uint64_t millis()
{
struct timeval te;
gettimeofday(&te, NULL); // get current time
uint64_t milliseconds = te.tv_sec*1000LL + te.tv_usec/1000; // calculate milliseconds
return milliseconds;
}