summary refs log tree commit diff
path: root/include/compat/sys/time.h
blob: 76428c190ddd9bb0ad26b0f5e6b0e71c855f1d34 (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
/*
 * Public domain
 * sys/time.h compatibility shim
 */

#ifndef LIBCRYPTOCOMPAT_SYS_TIME_H
#define LIBCRYPTOCOMPAT_SYS_TIME_H

#ifdef _MSC_VER
#include <winsock2.h>
int gettimeofday(struct timeval *tp, void *tzp);
#else
#include_next <sys/time.h>
#endif

#ifndef timersub
#define timersub(tvp, uvp, vvp)                                         \
	do {                                                            \
		(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec;          \
		(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec;       \
		if ((vvp)->tv_usec < 0) {                               \
			(vvp)->tv_sec--;                                \
			(vvp)->tv_usec += 1000000;                      \
		}                                                       \
	} while (0)
#endif

#endif
bd46c8affb7fb5d202f0ea8&follow=1'>Respond to pingsJune McEnroe 2019-10-23Add verbose flagJune McEnroe 2019-10-23Set NOSIGPIPE on server connectionJune McEnroe 2019-10-23Set an initial loop capJune McEnroe 2019-10-23Fix rest parsingJune McEnroe 2019-10-23Add dynamic poll listJune McEnroe 2019-10-23Don't assume commands have targets and handle ERRORJune McEnroe 2019-10-23Clean up state somewhatJune McEnroe 2019-10-23Actually send the buffer...June McEnroe 2019-10-23Add stateJune McEnroe