diff options
author | Bill Meier <wmeier@newsguy.com> | 2011-09-07 18:25:54 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2011-09-07 18:25:54 +0000 |
commit | 9c6aca43f23ede3949ee4cb9dbbcac98f6a05804 (patch) | |
tree | 1a40d423b720851e00aeb530f02ba0e25db66244 /dumpcap.c | |
parent | 001d5b59890a26d6fa1ca6b9aceda999c8982b8d (diff) |
Windows: GetTickCount() returns a DWORD (not a time_t);
Fixes a problem on Windows wherein specifying a capture file
time duration for autostop or file-switching would stop
working after some period of time.
The reason:
GetTickCount returns DWORD (unsigned int) which
wraps "every 49.7 days";
and: The GetTickCount() return value was being stored in a time_t which is
int64 on Windows;
thus:
The test for elapsed time (using signed integers) didn't work correctly after
the time had wrapped.
Fixes Bug #6280: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6280
svn path=/trunk/; revision=38921
Diffstat (limited to 'dumpcap.c')
-rw-r--r-- | dumpcap.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -3043,7 +3043,7 @@ static gboolean capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct pcap_stat *stats) { #ifdef WIN32 - time_t upd_time, cur_time; + DWORD upd_time, cur_time; /* GetTickCount() returns a "DWORD" (which is 'unsigned long') */ #else struct timeval upd_time, cur_time; #endif @@ -3267,8 +3267,8 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct #define DUMPCAP_UPD_TIME 500 #ifdef WIN32 - cur_time = GetTickCount(); - if ( (cur_time - upd_time) > DUMPCAP_UPD_TIME) { + cur_time = GetTickCount(); /* Note: wraps to 0 if sys runs for 49.7 days */ + if ((cur_time - upd_time) > DUMPCAP_UPD_TIME) { /* wrap just causes an extra update */ #else gettimeofday(&cur_time, NULL); if ((cur_time.tv_sec * 1000000 + cur_time.tv_usec) > |