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.8 by root, Fri Jan 2 23:23:32 2009 UTC vs.
Revision 1.12 by root, Mon Jun 29 07:27:54 2009 UTC

1/* 1/*
2 * libev win32 compatibility cruft (_not_ a backend) 2 * libev win32 compatibility cruft (_not_ a backend)
3 * 3 *
4 * Copyright (c) 2007,2008 Marc Alexander Lehmann <libev@schmorp.de> 4 * Copyright (c) 2007,2008,2009 Marc Alexander Lehmann <libev@schmorp.de>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without modifica- 7 * Redistribution and use in source and binary forms, with or without modifica-
8 * tion, are permitted provided that the following conditions are met: 8 * tion, are permitted provided that the following conditions are met:
9 * 9 *
53ev_pipe (int filedes [2]) 53ev_pipe (int filedes [2])
54{ 54{
55 struct sockaddr_in addr = { 0 }; 55 struct sockaddr_in addr = { 0 };
56 int addr_size = sizeof (addr); 56 int addr_size = sizeof (addr);
57 struct sockaddr_in adr2; 57 struct sockaddr_in adr2;
58 int adr2_size; 58 int adr2_size = sizeof (adr2);
59 SOCKET listener; 59 SOCKET listener;
60 SOCKET sock [2] = { -1, -1 }; 60 SOCKET sock [2] = { -1, -1 };
61 61
62 if ((listener = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) 62 if ((listener = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
63 return -1; 63 return -1;
131 return -1; 131 return -1;
132} 132}
133 133
134#undef pipe 134#undef pipe
135#define pipe(filedes) ev_pipe (filedes) 135#define pipe(filedes) ev_pipe (filedes)
136
137#define EV_HAVE_EV_TIME 1
138ev_tstamp
139ev_time (void)
140{
141 FILETIME ft;
142 ULARGE_INTEGER ui;
136 143
137static int 144 GetSystemTimeAsFileTime (&ft);
138ev_gettimeofday (struct timeval *tv, struct timezone *tz) 145 ui.u.LowPart = ft.dwLowDateTime;
139{ 146 ui.u.HighPart = ft.dwHighDateTime;
140 struct _timeb tb;
141 147
142 _ftime (&tb); 148 /* msvc cannot convert ulonglong to double... yes, it is that sucky */
143 149 return (LONGLONG)(ui.QuadPart - 116444736000000000) * 1e-7;
144 tv->tv_sec = (long)tb.time;
145 tv->tv_usec = ((long)tb.millitm) * 1000;
146
147 return 0;
148} 150}
149
150#undef gettimeofday
151#define gettimeofday(tv,tz) ev_gettimeofday (tv, tz)
152 151
153#endif 152#endif
154 153

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines