mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
Move qemu_gettimeofday() to OS specific files
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
949d31e665
commit
dc786bc910
10 changed files with 47 additions and 47 deletions
31
osdep.c
31
osdep.c
|
@ -111,37 +111,6 @@ int qemu_create_pidfile(const char *filename)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
/* mingw32 needs ffs for compilations without optimization. */
|
||||
int ffs(int i)
|
||||
{
|
||||
/* Use gcc's builtin ffs. */
|
||||
return __builtin_ffs(i);
|
||||
}
|
||||
|
||||
/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosec units */
|
||||
#define _W32_FT_OFFSET (116444736000000000ULL)
|
||||
|
||||
int qemu_gettimeofday(qemu_timeval *tp)
|
||||
{
|
||||
union {
|
||||
unsigned long long ns100; /*time since 1 Jan 1601 in 100ns units */
|
||||
FILETIME ft;
|
||||
} _now;
|
||||
|
||||
if(tp)
|
||||
{
|
||||
GetSystemTimeAsFileTime (&_now.ft);
|
||||
tp->tv_usec=(long)((_now.ns100 / 10ULL) % 1000000ULL );
|
||||
tp->tv_sec= (long)((_now.ns100 - _W32_FT_OFFSET) / 10000000ULL);
|
||||
}
|
||||
/* Always return 0 as per Open Group Base Specifications Issue 6.
|
||||
Do not set errno on error. */
|
||||
return 0;
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
/*
|
||||
* Opens a file with FD_CLOEXEC set
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue