Skip to content

Commit 559a3f9

Browse files
committed
rfb: make gettimeofday() win32 fallback a #define
1 parent 880740d commit 559a3f9

3 files changed

Lines changed: 15 additions & 28 deletions

File tree

examples/server/camera.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,6 @@
4545
/* if we have gettimeofday(), it is in this header */
4646
#include <sys/time.h>
4747
#endif
48-
#if !defined LIBVNCSERVER_HAVE_GETTIMEOFDAY && defined WIN32
49-
#include <fcntl.h>
50-
#include <conio.h>
51-
#include <sys/timeb.h>
52-
53-
static void gettimeofday(struct timeval* tv,char* dummy)
54-
{
55-
SYSTEMTIME t;
56-
GetSystemTime(&t);
57-
tv->tv_sec=t.wHour*3600+t.wMinute*60+t.wSecond;
58-
tv->tv_usec=t.wMilliseconds*1000;
59-
}
60-
#endif
61-
6248

6349
#define WIDTH 640
6450
#define HEIGHT 480

libvncserver/main.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,20 +1375,6 @@ void rfbShutdownServer(rfbScreenInfoPtr screen,rfbBool disconnectClients) {
13751375
#endif
13761376
}
13771377

1378-
#if !defined LIBVNCSERVER_HAVE_GETTIMEOFDAY && defined WIN32
1379-
#include <fcntl.h>
1380-
#include <conio.h>
1381-
#include <sys/timeb.h>
1382-
1383-
static void gettimeofday(struct timeval* tv,char* dummy)
1384-
{
1385-
SYSTEMTIME t;
1386-
GetSystemTime(&t);
1387-
tv->tv_sec=t.wHour*3600+t.wMinute*60+t.wSecond;
1388-
tv->tv_usec=t.wMilliseconds*1000;
1389-
}
1390-
#endif
1391-
13921378
rfbBool
13931379
rfbProcessEvents(rfbScreenInfoPtr screen,long usec)
13941380
{

rfb/rfbproto.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,21 @@ typedef uint32_t in_addr_t;
130130
#define INADDR_NONE ((in_addr_t) 0xffffffff)
131131
#endif
132132

133+
#if !defined LIBVNCSERVER_HAVE_GETTIMEOFDAY && defined WIN32
134+
#include <fcntl.h>
135+
#include <conio.h>
136+
#include <sys/timeb.h>
137+
138+
#define gettimeofday(tv, dummy) \
139+
{ \
140+
SYSTEMTIME t; \
141+
GetSystemTime(&t); \
142+
(tv)->tv_sec=t.wHour*3600+t.wMinute*60+t.wSecond; \
143+
(tv)->tv_usec=t.wMilliseconds*1000; \
144+
}
145+
#endif
146+
147+
133148
#define MAX_ENCODINGS 64
134149

135150

0 commit comments

Comments
 (0)