solo1/time.c

11 wiersze
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;
}