source: installer/lib/wrapper/macosx/wrapper.c.diff @ d6c3ffd

Last change on this file since d6c3ffd was d6c3ffd, checked in by zzz <zzz@…>, 15 years ago

2005-09-17 jrandom

  • Added the natively compiled jbigi and patched java service wrapper for OS X. Thanks Bill Dorsey for letting me use your machine!
  • Don't build i2p.exe or i2pinstall.exe when run on OS X machines, as we don't bundle the binutils necessary (and there'd be a naming conflict if we did).
  • Added 'single user' functionality to syndie - if the single user checkbox on the admin page is checked, all users are allowed to control the instance and sync up with remote syndie nodes.
  • Temporarily disable the x-i2p-gzip in i2ptunnel until it is more closely debugged.
  • Property mode set to 100644
File size: 1.9 KB
RevLine 
[d6c3ffd]1--- wrapper_3.1.1_src/src/c/wrapper.c   Fri Jul 16 10:29:10 2004
2+++ wrapper_3.1.1_src_modified/src/c/wrapper.c  Fri Sep 16 14:55:23 2005
3@@ -312,7 +312,13 @@
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <time.h>
7+
8+#ifdef MACOSX
9+#include <sys/time.h>
10+#else
11 #include <sys/timeb.h>
12+#endif
13+
14 #include <sys/stat.h>
15 #include "wrapperinfo.h"
16 #include "wrapper.h"
17@@ -760,16 +766,28 @@
18     int len;
19     int pos;
20     int err;
21+
22+    #ifdef MACOSX
23+    struct timeval timeBuffer;
24+    #else
25     struct timeb timeBuffer;
26+    #endif
27+
28     long startTime;
29     int startTimeMillis;
30     long now;
31     int nowMillis;
32     long durr;
33     
34+#ifdef MACOSX
35+    gettimeofday(&timeBuffer, NULL);
36+    startTime = now = timeBuffer.tv_sec;
37+    startTimeMillis = nowMillis = timeBuffer.tv_usec / 1000;
38+#else
39     ftime( &timeBuffer );
40     startTime = now = timeBuffer.time;
41     startTimeMillis = nowMillis = timeBuffer.millitm;
42+#endif
43 
44     /*
45     log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_DEBUG, "now=%ld, nowMillis=%d", now, nowMillis);
46@@ -900,9 +918,15 @@
47         }
48 
49         /* Get the time again */
50+#ifdef MACOSX
51+        gettimeofday(&timeBuffer, NULL);
52+        now = timeBuffer.tv_sec;
53+        nowMillis = timeBuffer.tv_usec / 1000;
54+#else
55         ftime( &timeBuffer );
56         now = timeBuffer.time;
57         nowMillis = timeBuffer.millitm;
58+#endif
59     }
60     /*
61     log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_DEBUG, "done durr=%ld", durr);
62@@ -2250,10 +2274,15 @@
63  * Calculates a tick count using the system time.
64  */
65 DWORD wrapperGetSystemTicks() {
66+#ifdef MACOSX
67+    struct timeval timeBuffer;
68+    gettimeofday(&timeBuffer, NULL);
69+    return (timeBuffer.tv_sec * 1000 + timeBuffer.tv_usec/1000) / WRAPPER_TICK_MS;
70+#else
71     struct timeb timeBuffer;
72-
73     ftime( &timeBuffer );
74     return (timeBuffer.time * 1000 + timeBuffer.millitm) / WRAPPER_TICK_MS;
75+#endif
76 }
77 
78 /**
Note: See TracBrowser for help on using the repository browser.