/[LeafOK_CVS]/pvpgn-1.7.4/src/compat/gettimeofday.c
ViewVC logotype

Contents of /pvpgn-1.7.4/src/compat/gettimeofday.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Tue Jun 6 03:41:38 2006 UTC (19 years, 9 months ago) by sysadm
Branch: GNU, MAIN
CVS Tags: arelease, HEAD
Changes since 1.1: +0 -0 lines
Content type: text/x-csrc
no message

1 /*
2 * Copyright (C) 2000 Ross Combs (rocombs@cs.nmsu.edu)
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18 #include "common/setup_before.h"
19 #ifndef HAVE_GETTIMEOFDAY
20
21 #include <errno.h>
22 #ifdef TIME_WITH_SYS_TIME
23 # include <sys/time.h>
24 # include <time.h>
25 #else
26 # ifdef HAVE_SYS_TIME_H
27 # include <sys/time.h>
28 # else
29 # include <time.h>
30 # endif
31 #endif
32 #ifdef HAVE_SYS_TIMEB_H
33 # include <sys/timeb.h>
34 #endif
35 #include "gettimeofday.h"
36 #include "common/setup_after.h"
37
38
39 extern gettimeofday(struct timeval * tv, struct timezone * tz)
40 {
41 #ifdef HAVE_FTIME
42 struct timeb tb;
43 #endif
44
45 if (!tv)
46 {
47 errno = EFAULT;
48 return -1;
49 }
50
51 #ifdef HAVE_FTIME
52 tb.millitm = 0; /* apparently the MS CRT version of this doesn't set this member */
53 /* FIXME: what would be a more appropriate function for that platform? */
54 ftime(&tb); /* FIXME: some versions are void return others int */
55
56 tv->tv_sec = tb.time;
57 tv->tv_usec = ((long)tb.millitm)*1000;
58 if (tz)
59 {
60 tz->tz_minuteswest = 0;
61 tz->tz_dsttime = 0;
62 }
63
64 return 0;
65 #else
66 # error "This program requires either gettimeofday() or ftime()"
67 #endif
68 }
69
70 #else
71 typedef int filenotempty; /* make ISO standard happy */
72 #endif

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1