Fix windows build.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2026-04-29 15:36:53 +02:00
parent 0abea5b6b2
commit 707cdf7bf4
16 changed files with 185 additions and 90 deletions

View File

@@ -49,6 +49,19 @@ int gettimeofday(struct timeval* tp, struct timezone* tzp)
tp->tv_usec = (long)(system_time.wMilliseconds * 1000);
return 0;
}
int settimeofday(const struct timeval* tp, const struct timezone* tzp)
{
(void)tzp;
SYSTEMTIME st;
FILETIME ft;
uint64_t time;
time = ((uint64_t)tp->tv_sec * 10000000L) + ((uint64_t)tp->tv_usec * 10) + ((uint64_t)116444736000000000ULL);
ft.dwLowDateTime = (uint32_t)(time & 0xFFFFFFFF);
ft.dwHighDateTime = (uint32_t)(time >> 32);
FileTimeToSystemTime(&ft, &st);
return SetSystemTime(&st);
}
#endif