* src/bin/Makefile.am:

* src/bin/evil_test_gettimeofday.c:
	fix unit test; now all tests pass, finally
	* src/lib/evil_unistd.c:
	fix gettimeofday() on mingw32ce



SVN revision: 38130
This commit is contained in:
Vincent Torri 2008-12-13 18:43:16 +00:00
parent 87ededafe7
commit 55f7df7ef9
4 changed files with 19 additions and 7 deletions

View File

@ -1,3 +1,12 @@
2008-12-13 Vincent Torri <doursse at users dot sf dot net>
* src/bin/Makefile.am:
* src/bin/evil_test_gettimeofday.c:
fix unit test; now all tests pass, finally
* src/lib/evil_unistd.c:
fix gettimeofday() on mingw32ce
2008-12-13 Vincent Torri <doursse at users dot sf dot net>
* src/bin/Makefile.am:

View File

@ -30,7 +30,7 @@ evil_suite_SOURCES += memcpy_glibc_arm.S
endif
evil_suite_LDADD = $(top_builddir)/src/lib/libevil.la $(top_builddir)/src/lib/dlfcn/libdl.la
evil_suite_LDADD = $(top_builddir)/src/lib/libevil.la $(top_builddir)/src/lib/dlfcn/libdl.la -lm
evil_suite_LDFLAGS = -Wl,--enable-auto-import
test_pipe_SOURCES = test_pipe.c

View File

@ -6,6 +6,7 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <Evil.h>
@ -20,14 +21,13 @@ test_time_tests_run(suite *s)
gettimeofday (&tp1, NULL);
Sleep(997);
Sleep(1000);
gettimeofday (&tp2, NULL);
delta = (double)tp2.tv_sec - tp1.tv_sec + (tp2.tv_usec - tp1.tv_usec) / 1000000.0;
if (delta > 0.005)
delta = (double)(tp2.tv_sec - tp1.tv_sec) + (double)(tp2.tv_usec - tp1.tv_usec) / 1000000.0;
if (fabs(delta - 1) > 0.005)
{
printf (" * %f\n", delta);
return 0;
}

View File

@ -59,8 +59,11 @@ _evil_systemtime_to_time(SYSTEMTIME st)
int
evil_gettimeofday(struct timeval *tp, void *tzp __UNUSED__)
{
tp->tv_sec = _evil_time_second;
tp->tv_usec = (GetTickCount() - _evil_time_millisecond) * 1000;
int milli_sec;
milli_sec = (int)GetTickCount() - _evil_time_millisecond;
tp->tv_sec = _evil_time_second + milli_sec / 1000;
tp->tv_usec = (milli_sec % 1000) * 1000;
return 1;
}