I had a weird timing glitch when running mstpcap which I think was caused by a truncation error in timer.c so I've made some slight changes to try stop it happening again.

This commit is contained in:
petermcs
2012-04-30 08:31:41 +00:00
parent 8017610632
commit 44055ff37f
+2 -2
View File
@@ -84,7 +84,7 @@ int gettimeofday(
/* a 64-bit value representing the number of
100-nanosecond intervals since January 1, 1601 (UTC). */
GetSystemTimeAsFileTime(&ft);
usec_timer |= ft.dwHighDateTime;
usec_timer = ft.dwHighDateTime;
usec_timer <<= 32;
usec_timer |= ft.dwLowDateTime;
/*converting file time to unix epoch 1970 */
@@ -95,7 +95,7 @@ int gettimeofday(
time_start = timeGetTime();
} else {
elapsed_milliseconds = timeGetTime() - time_start;
usec_elapsed = usec_timer + (elapsed_milliseconds * 1000UL);
usec_elapsed = usec_timer + ((LONGLONG)elapsed_milliseconds * 1000UL);
tp->tv_sec = (long) (usec_elapsed / 1000000UL);
tp->tv_usec = (long) (usec_elapsed % 1000000UL);
}