freebsd-ports/net/hawknl-devel/files/patch-src_htcondition.c
Edwin Groothuis c894a71802 [REPOCOPY] net/hawknl-devel: Portable networking library (devel)
HawkNL is a free, open source, game oriented network API
	released under the GNU Library General Public License (LGPL).
	HawkNL (NL) is a fairly low level API, a wrapper over
	Berkeley/Unix Sockets and Winsock.

	But NL also provides other features including support for
	many OSs, groups of sockets, socket statistics, high accuracy
	timer, CRC functions, macros to read and write data to
	packets with endian conversion, and support for multiple
	network transports.

	NL has been tested on Windows 9x/ME/NT/2000/XP/CE, Linux,
	Solaris, IRIX, AIX, BSDs, Mac OSX.

	WWW:	http://www.hawksoft.com/hawknl/

PR:		ports/94984
Submitted by:	Jose Alonso Cardenas Marquez <acardenas@bsd.org.pe>
2006-04-04 22:44:04 +00:00

30 lines
849 B
C

--- src/htcondition.c Sun Mar 5 16:05:39 2006
+++ src/htcondition.c Sun Mar 5 16:06:17 2006
@@ -37,8 +37,6 @@
#else /* !HT_WIN_THREADS */
-#include <sys/timeb.h>
-
#ifdef HL_WINDOWS_APP
#define timeb _timeb
#define ftime _ftime
@@ -156,13 +154,14 @@
#else
int result = 0;
struct timespec tv;
- struct timeb t;
+ struct timeval t;
+ struct timezone tz;
long ms;
/* convert timeout to an absolute time */
- ftime(&t);
- ms = t.millitm + timeout;
- tv.tv_sec = t.time + (ms / 1000);
+ gettimeofday(&t, &tz);
+ ms = (t.tv_sec * 1000) + timeout;
+ tv.tv_sec = t.tv_sec + (ms / 1000);
tv.tv_nsec = (ms % 1000) * 1000000;
(void)pthread_mutex_lock((pthread_mutex_t *)&cv->mutex);