1 /*
2  *  Copyright (C) 2013-2022 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
3  *  Copyright (C) 2009-2013 Sourcefire, Inc.
4  *
5  *  Authors: aCaB <acab@clamav.net>
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License version 2 as
9  *  published by the Free Software Foundation.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  *  MA 02110-1301, USA.
20  */
21 
22 #if HAVE_CONFIG_H
23 #include "clamav-config.h"
24 #endif
25 
26 #include <WinSock2.h>
27 #include <Windows.h>
28 #include <sys/types.h>
29 #include <sys/timeb.h>
30 
31 #include "gettimeofday.h"
32 
gettimeofday(struct timeval * tv,struct timezone * tz)33 int gettimeofday(struct timeval *tv, struct timezone *tz)
34 {
35     struct _timeb t;
36 
37     _ftime_s(&t);
38     tv->tv_sec  = t.time;
39     tv->tv_usec = t.millitm * 1000;
40     return 0;
41 }
42