minecraft-pi-reborn/mods/src/time.c

11 lines
326 B
C
Raw Normal View History

2020-11-08 03:26:22 +00:00
#include <sys/time.h>
#include <time.h>
// Replace gettimeofday() With clock_gettime()
2020-11-08 03:26:22 +00:00
int gettimeofday(struct timeval *tv, __attribute__((unused)) void *tz) {
struct timespec tp;
2020-11-11 15:22:14 +00:00
int ret = clock_gettime(CLOCK_MONOTONIC_COARSE, &tp);
2020-11-08 03:26:22 +00:00
tv->tv_sec = tp.tv_sec;
tv->tv_usec = tp.tv_nsec * 0.001;
return ret;
}