/*
Win32 mdnsclient
This program is free software; you can redistribute it and/or modify it
under the terms of version 2 the GNU Lesser General Public License as
published by the Free Software Foundation.
It is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with nss-mdns; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
*/
#include <winsock2.h>
#include <ws2tcpip.h>
#include <assert.h>
#include "inttypes.h"
#include "win32.h"
int gettimeofday (struct timeval *tv, void* tz)
{
union
{
__int64 ns100; /*time since 1 Jan 1601 in 100ns units */
FILETIME ft;
} now;
GetSystemTimeAsFileTime (&now.ft);
tv->tv_usec = (long) ((now.ns100 / 10LL) % 1000000LL);
tv->tv_sec = (long) ((now.ns100 - 116444736000000000LL) / 10000000LL);
return (0);
}
syntax highlighted by Code2HTML, v. 0.9.1