forked from osmocom/wireshark
Make sure that reset the elapsed time to load a file before we reload/rescan the file
svn path=/trunk/; revision=29783
This commit is contained in:
parent
8d909ba79e
commit
c6f96e4ec9
44
file.c
44
file.c
|
@ -243,6 +243,29 @@ cf_timestamp_auto_precision(capture_file *cf)
|
|||
#endif
|
||||
}
|
||||
|
||||
gulong
|
||||
cf_get_computed_elapsed(void)
|
||||
{
|
||||
return computed_elapsed;
|
||||
}
|
||||
|
||||
static void reset_elapsed(void)
|
||||
{
|
||||
computed_elapsed = 0;
|
||||
}
|
||||
|
||||
static void compute_elapsed(GTimeVal *start_time)
|
||||
{
|
||||
gdouble delta_time;
|
||||
GTimeVal time_now;
|
||||
|
||||
g_get_current_time(&time_now);
|
||||
|
||||
delta_time = (time_now.tv_sec - start_time->tv_sec) * 1e6 +
|
||||
time_now.tv_usec - start_time->tv_usec;
|
||||
|
||||
computed_elapsed = (gulong) (delta_time / 1000); /* ms*/
|
||||
}
|
||||
|
||||
cf_status_t
|
||||
cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
|
||||
|
@ -280,6 +303,8 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
|
|||
/* If it's a temporary capture buffer file, mark it as not saved. */
|
||||
cf->user_saved = !is_tempfile;
|
||||
|
||||
reset_elapsed();
|
||||
|
||||
cf->cd_t = wtap_file_type(cf->wth);
|
||||
cf->count = 0;
|
||||
cf->displayed_count = 0;
|
||||
|
@ -428,23 +453,6 @@ void outofmemory_cb(gpointer dialog _U_, gint btn _U_, gpointer data _U_)
|
|||
main_window_exit();
|
||||
}
|
||||
|
||||
gulong
|
||||
cf_get_computed_elapsed(void){
|
||||
return computed_elapsed;
|
||||
}
|
||||
static void compute_elapsed(GTimeVal *start_time)
|
||||
{
|
||||
gdouble delta_time;
|
||||
GTimeVal time_now;
|
||||
|
||||
g_get_current_time(&time_now);
|
||||
|
||||
delta_time = (time_now.tv_sec - start_time->tv_sec) * 1e6 +
|
||||
time_now.tv_usec - start_time->tv_usec;
|
||||
|
||||
computed_elapsed = (gulong) (delta_time / 1000); /* ms*/
|
||||
}
|
||||
|
||||
static float calc_progbar_val(capture_file *cf, gint64 size, gint64 file_pos){
|
||||
|
||||
float progbar_val;
|
||||
|
@ -1750,6 +1758,8 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item,
|
|||
cf->first_displayed = NULL;
|
||||
cf->last_displayed = NULL;
|
||||
|
||||
reset_elapsed();
|
||||
|
||||
/* We currently don't display any packets */
|
||||
cf->displayed_count = 0;
|
||||
|
||||
|
|
|
@ -364,12 +364,9 @@ profile_bar_new(void)
|
|||
/*
|
||||
* update the packets statusbar to the current values
|
||||
*/
|
||||
void
|
||||
void
|
||||
packets_bar_update(void)
|
||||
{
|
||||
|
||||
gulong computed_elapsed = cf_get_computed_elapsed();
|
||||
|
||||
if(packets_bar) {
|
||||
/* remove old status */
|
||||
if(packets_str) {
|
||||
|
@ -383,6 +380,8 @@ gulong computed_elapsed = cf_get_computed_elapsed();
|
|||
packets_str = g_strdup_printf(" Packets: %u Displayed: %u Marked: %u Dropped: %u",
|
||||
cfile.count, cfile.displayed_count, cfile.marked_count, cfile.drops);
|
||||
} else {
|
||||
gulong computed_elapsed = cf_get_computed_elapsed();
|
||||
|
||||
packets_str = g_strdup_printf(" Packets: %u Displayed: %u Marked: %u Time: %02lu:%02lu:%02lu.%03lu",
|
||||
cfile.count, cfile.displayed_count, cfile.marked_count,
|
||||
computed_elapsed/3600000,
|
||||
|
|
Loading…
Reference in New Issue