forked from osmocom/wireshark
"localtime()" returns a value that might not survive a subsequent call
to "localtime()" (it might, for example, be static - and *is* static in a lot of implementations). Don't call it twice and expect both values to be useful. Clean up white space. svn path=/trunk/; revision=11783
This commit is contained in:
parent
fe87609956
commit
747f63150b
16
capinfo.c
16
capinfo.c
|
@ -97,24 +97,20 @@ print_stats(capture_info *cf_info)
|
||||||
{
|
{
|
||||||
const gchar *file_type_string;
|
const gchar *file_type_string;
|
||||||
time_t start_time_t;
|
time_t start_time_t;
|
||||||
struct tm *start_time_tm;
|
|
||||||
time_t stop_time_t;
|
time_t stop_time_t;
|
||||||
struct tm *stop_time_tm;
|
|
||||||
|
|
||||||
/* Build printable strings for various stats */
|
/* Build printable strings for various stats */
|
||||||
file_type_string = wtap_file_type_string(cf_info->file_type);
|
file_type_string = wtap_file_type_string(cf_info->file_type);
|
||||||
start_time_t = (long)cf_info->start_time;
|
start_time_t = (time_t)cf_info->start_time;
|
||||||
stop_time_t = (long)cf_info->stop_time;
|
stop_time_t = (time_t)cf_info->stop_time;
|
||||||
start_time_tm = localtime (&start_time_t);
|
|
||||||
stop_time_tm = localtime (&stop_time_t);
|
|
||||||
|
|
||||||
if (cap_file_type) printf("File Type: %s\n", file_type_string);
|
if (cap_file_type) printf("File Type: %s\n", file_type_string);
|
||||||
if (cap_packet_count) printf("Number of packets: %u \n", cf_info->packet_count);
|
if (cap_packet_count) printf("Number of packets: %u \n", cf_info->packet_count);
|
||||||
if (cap_file_size) printf("File Size: %" PRIu64 " bytes\n", cf_info->filesize);
|
if (cap_file_size) printf("File Size: %" PRIu64 " bytes\n", cf_info->filesize);
|
||||||
if (cap_data_size) printf("Data Size: %" PRIu64 " bytes\n", cf_info->packet_bytes);
|
if (cap_data_size) printf("Data Size: %" PRIu64 " bytes\n", cf_info->packet_bytes);
|
||||||
if (cap_duration) printf("Capture duration: %f seconds\n", cf_info->duration);
|
if (cap_duration) printf("Capture duration: %f seconds\n", cf_info->duration);
|
||||||
if (cap_start_time) printf("Start time: %s", asctime (start_time_tm));
|
if (cap_start_time) printf("Start time: %s", ctime (&start_time_t));
|
||||||
if (cap_end_time) printf("End time: %s", asctime (stop_time_tm));
|
if (cap_end_time) printf("End time: %s", ctime (&stop_time_t));
|
||||||
if (cap_data_rate_byte) printf("Data rate: %.2f bytes/s\n", cf_info->data_rate);
|
if (cap_data_rate_byte) printf("Data rate: %.2f bytes/s\n", cf_info->data_rate);
|
||||||
if (cap_data_rate_bit) printf("Data rate: %.2f bits/s\n", cf_info->data_rate*8);
|
if (cap_data_rate_bit) printf("Data rate: %.2f bits/s\n", cf_info->data_rate*8);
|
||||||
if (cap_packet_size) printf("Average packet size: %.2f bytes\n", cf_info->packet_size);
|
if (cap_packet_size) printf("Average packet size: %.2f bytes\n", cf_info->packet_size);
|
||||||
|
@ -288,9 +284,7 @@ int main(int argc, char *argv[])
|
||||||
usage(TRUE);
|
usage(TRUE);
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optind < 2) {
|
if (optind < 2) {
|
||||||
|
@ -307,7 +301,6 @@ int main(int argc, char *argv[])
|
||||||
cap_data_rate_byte = TRUE;
|
cap_data_rate_byte = TRUE;
|
||||||
cap_data_rate_bit = TRUE;
|
cap_data_rate_bit = TRUE;
|
||||||
cap_packet_size = TRUE;
|
cap_packet_size = TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((argc - optind) < 1) {
|
if ((argc - optind) < 1) {
|
||||||
|
@ -330,7 +323,6 @@ int main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status = process_cap_file(wth);
|
status = process_cap_file(wth);
|
||||||
|
|
Loading…
Reference in New Issue