Support for g++-4.1.
[gf1.git] / gettimeofday.c
blob5c7814beca79b0f649157a2bf09ee9f5a255d8fc
1 /*
2 ** $Id$
3 **
4 ** implement gettimeofday() using ftime()
5 ** to be used on systems that don't have a gettimeofday() but
6 ** have an ftime() with a resolution smaller than 1 second
7 **
8 ** => Windows
9 */
11 ** Copyright (C) 1998 Kurt Van den Branden
13 ** This program is free software; you can redistribute it and/or modify
14 ** it under the terms of the GNU General Public License as published by
15 ** the Free Software Foundation; either version 2 of the License, or
16 ** (at your option) any later version.
17 **
18 ** This program is distributed in the hope that it will be useful,
19 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ** GNU General Public License for more details.
22 **
23 ** You should have received a copy of the GNU General Public License
24 ** along with this program; if not, write to the Free Software
25 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #ifdef MSWIN
30 #include "gettimeofday.h"
32 int gettimeofday (struct timeval * tv, struct timezone * tz)
34 struct timeb tp;
36 if (tv == 0)
37 return (0);
39 ftime (&tp);
40 tv->tv_sec = tp.time;
41 tv->tv_usec = tp.millitm * 1000;
43 return (0);
46 #endif