summaryrefslogtreecommitdiff
path: root/graphics/glide3/files/patch-swlibs-fxmisc-fxos_c
blob: a9808cc4ad8a8ef92389b6af4b129e017cbadad9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
--- swlibs/fxmisc/fxos.c.orig	Wed Jan 15 10:01:58 2003
+++ swlibs/fxmisc/fxos.c	Sun Jul  1 01:56:10 2007
@@ -43,13 +43,26 @@
 #include <fxos.h>
 #endif
 #if !macintosh
-/* return current time in seconds (floating point)      */
-float fxTime(void)
-{
 #if defined ( __sparc__ ) || defined ( __DJGPP__ )
 /* times returns 0 in BSD Unix, so we use ftime instead */
 #   include <sys/types.h>
 #   include <sys/timeb.h>
+#elif defined(__FreeBSD__)
+#   include <sys/time.h>
+#elif defined ( WIN32 ) || ( __DOS__ )
+#   include <time.h>
+#   define times(a) clock()
+#   define HZ   CLOCKS_PER_SEC
+#else
+#   include <sys/types.h>
+#   include <sys/times.h>
+#   include <sys/param.h>
+#endif
+
+/* return current time in seconds (floating point)      */
+float fxTime(void)
+{
+#if defined ( __sparc__ ) || defined ( __DJGPP__ )
     struct timeb tb;
     static time_t once;                 // saves first time value
 
@@ -59,22 +72,12 @@
     return (tb.time - once) + tb.millitm * .001;
     
 #elif defined(__FreeBSD__)
-#include <sys/time.h>
     struct timeval t;
     struct timezone tz;
     gettimeofday(&t, &tz);
     return ((float)t.tv_sec + ((float)t.tv_usec)/1000000.0);
 #else
-#if defined ( WIN32 ) || ( __DOS__ )
-#   include <time.h>
-#   define times(a) clock()
-#   define HZ   CLOCKS_PER_SEC
-#else
-#   include <sys/types.h>
-#   include <sys/times.h>
-#   include <sys/param.h>
     struct tms foo;
-#endif
     return times(&foo)/(float)HZ;
 #endif
 }