ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev_win32.c
(Generate patch)

Comparing libev/ev_win32.c (file contents):
Revision 1.15 by root, Sun Feb 19 02:03:11 2012 UTC vs.
Revision 1.21 by root, Tue Nov 19 20:09:49 2019 UTC

36 * provisions above, a recipient may use your version of this file under 36 * provisions above, a recipient may use your version of this file under
37 * either the BSD or the GPL. 37 * either the BSD or the GPL.
38 */ 38 */
39 39
40#ifdef _WIN32 40#ifdef _WIN32
41
42/* timeb.h is actually xsi legacy functionality */
43#include <sys/timeb.h>
44 41
45/* note: the comment below could not be substantiated, but what would I care */ 42/* note: the comment below could not be substantiated, but what would I care */
46/* MSDN says this is required to handle SIGFPE */ 43/* MSDN says this is required to handle SIGFPE */
47/* my wild guess would be that using something floating-pointy is required */ 44/* my wild guess would be that using something floating-pointy is required */
48/* for the crt to do something about it */ 45/* for the crt to do something about it */
89 goto fail; 86 goto fail;
90 87
91 if (connect (sock [0], (struct sockaddr *)&addr, addr_size)) 88 if (connect (sock [0], (struct sockaddr *)&addr, addr_size))
92 goto fail; 89 goto fail;
93 90
91 /* TODO: returns INVALID_SOCKET on winsock accept, not < 0. fix it */
92 /* when convenient, probably by just removing error checking altogether? */
94 if ((sock [1] = accept (listener, 0, 0)) < 0) 93 if ((sock [1] = accept (listener, 0, 0)) < 0)
95 goto fail; 94 goto fail;
96 95
97 /* windows vista returns fantasy port numbers for sockets: 96 /* windows vista returns fantasy port numbers for sockets:
98 * example for two interconnected tcp sockets: 97 * example for two interconnected tcp sockets:
141 return -1; 140 return -1;
142} 141}
143 142
144#undef pipe 143#undef pipe
145#define pipe(filedes) ev_pipe (filedes) 144#define pipe(filedes) ev_pipe (filedes)
146 145
147#define EV_HAVE_EV_TIME 1 146#define EV_HAVE_EV_TIME 1
148ev_tstamp 147ev_tstamp
149ev_time (void) 148ev_time (void)
150{ 149{
151 FILETIME ft; 150 FILETIME ft;
153 152
154 GetSystemTimeAsFileTime (&ft); 153 GetSystemTimeAsFileTime (&ft);
155 ui.u.LowPart = ft.dwLowDateTime; 154 ui.u.LowPart = ft.dwLowDateTime;
156 ui.u.HighPart = ft.dwHighDateTime; 155 ui.u.HighPart = ft.dwHighDateTime;
157 156
158 /* msvc cannot convert ulonglong to double... yes, it is that sucky */ 157 /* also, msvc cannot convert ulonglong to double... yes, it is that sucky */
159 return (LONGLONG)(ui.QuadPart - 116444736000000000) * 1e-7; 158 return EV_TS_FROM_USEC (((LONGLONG)(ui.QuadPart - 116444736000000000) * 1e-1));
160} 159}
161 160
162#endif 161#endif
163 162

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines