int displayed_count; /* Number of displayed frames */
int marked_count; /* Number of marked frames */
gboolean drops_known; /* TRUE if we know how many packets were dropped */
- guint32 drops; /* Dropped packets */
- nstime_t elapsed_time;/* Elapsed time (see: tsaccur below!) */
+ guint32 drops; /* Dropped packets */
+ nstime_t elapsed_time;/* Elapsed time */
gboolean has_snap; /* TRUE if maximum capture packet length is known */
int snap; /* Maximum captured packet length */
wtap *wth; /* Wiretap session */
dfilter_t *rfcode; /* Compiled read (display) filter program */
gchar *dfilter; /* Display filter string */
dfilter_t *dfcode; /* Compiled display filter program */
+ /* search */
gchar *sfilter; /* Search filter string */
gboolean sbackward; /* TRUE if search is backward, FALSE if forward */
gboolean hex; /* TRUE is raw data search is being performed */
gboolean case_type; /* TRUE if case-insensitive text search */
gboolean decode_data; /* TRUE if searching protocol tree text */
gboolean summary_data; /* TRUE if searching Info column text */
+ /* packet data */
union wtap_pseudo_header pseudo_header; /* Packet pseudo_header */
guint8 pd[WTAP_MAX_PACKET_SIZE]; /* Packet data */
GMemChunk *plist_chunk; /* Memory chunk for frame_data structures */
epan_dissect_t *edt; /* Protocol dissection for currently selected packet */
field_info *finfo_selected; /* Field info for currently selected field */
struct ph_stats_s* pstats; /* accumulated stats (reset on redisplay in GUI)*/
- int tsprecision; /* timestamp precision
- (WTAP_FILE_TSPREC_USEC or WTAP_FILE_TSPREC_NSEC) */
} capture_file;
void init_cap_file(capture_file *);
e_prefs *prefs;
dfilter_t *df;
- set_timestamp_setting(TS_RELATIVE);
+ timestamp_set_type(TS_RELATIVE);
/* register all dissectors; we must do this before checking for the
"-g" flag, as the "-g" flag dumps a list of fields registered
then = fd->abs_ts.secs;
tmp = localtime(&then);
if (tmp != NULL) {
- g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
+ switch(timestamp_get_precision()) {
+ case(TS_PREC_FIXED_SEC):
+ case(TS_PREC_AUTO_SEC):
+ g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
+ "%04d-%02d-%02d %02d:%02d:%02d",
+ tmp->tm_year + 1900,
+ tmp->tm_mon + 1,
+ tmp->tm_mday,
+ tmp->tm_hour,
+ tmp->tm_min,
+ tmp->tm_sec);
+ break;
+ case(TS_PREC_FIXED_DSEC):
+ case(TS_PREC_AUTO_DSEC):
+ g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
+ "%04d-%02d-%02d %02d:%02d:%02d.%01ld",
+ tmp->tm_year + 1900,
+ tmp->tm_mon + 1,
+ tmp->tm_mday,
+ tmp->tm_hour,
+ tmp->tm_min,
+ tmp->tm_sec,
+ (long)fd->abs_ts.nsecs / 100000000);
+ break;
+ case(TS_PREC_FIXED_CSEC):
+ case(TS_PREC_AUTO_CSEC):
+ g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
+ "%04d-%02d-%02d %02d:%02d:%02d.%02ld",
+ tmp->tm_year + 1900,
+ tmp->tm_mon + 1,
+ tmp->tm_mday,
+ tmp->tm_hour,
+ tmp->tm_min,
+ tmp->tm_sec,
+ (long)fd->abs_ts.nsecs / 10000000);
+ break;
+ case(TS_PREC_FIXED_MSEC):
+ case(TS_PREC_AUTO_MSEC):
+ g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
+ "%04d-%02d-%02d %02d:%02d:%02d.%03ld",
+ tmp->tm_year + 1900,
+ tmp->tm_mon + 1,
+ tmp->tm_mday,
+ tmp->tm_hour,
+ tmp->tm_min,
+ tmp->tm_sec,
+ (long)fd->abs_ts.nsecs / 1000000);
+ break;
+ case(TS_PREC_FIXED_USEC):
+ case(TS_PREC_AUTO_USEC):
+ g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
"%04d-%02d-%02d %02d:%02d:%02d.%06ld",
tmp->tm_year + 1900,
tmp->tm_mon + 1,
tmp->tm_hour,
tmp->tm_min,
tmp->tm_sec,
- (long)fd->abs_ts.nsecs / 1000); /* XXX - this has to be improved */
+ (long)fd->abs_ts.nsecs / 1000);
+ break;
+ case(TS_PREC_FIXED_NSEC):
+ case(TS_PREC_AUTO_NSEC):
+ g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
+ "%04d-%02d-%02d %02d:%02d:%02d.%09ld",
+ tmp->tm_year + 1900,
+ tmp->tm_mon + 1,
+ tmp->tm_mday,
+ tmp->tm_hour,
+ tmp->tm_min,
+ tmp->tm_sec,
+ (long)fd->abs_ts.nsecs);
+ break;
+ default:
+ g_assert_not_reached();
+ }
} else {
cinfo->col_buf[col][0] = '\0';
}
static void
col_set_rel_time(frame_data *fd, column_info *cinfo, int col)
{
- display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
- fd->rel_ts.secs, fd->rel_ts.nsecs / 1000, USECS); /* XXX - this has to be improved */
+ switch(timestamp_get_precision()) {
+ case(TS_PREC_FIXED_SEC):
+ case(TS_PREC_AUTO_SEC):
+ display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ fd->rel_ts.secs, fd->rel_ts.nsecs / 1000000000, SECS);
+ break;
+ case(TS_PREC_FIXED_DSEC):
+ case(TS_PREC_AUTO_DSEC):
+ display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ fd->rel_ts.secs, fd->rel_ts.nsecs / 100000000, DSECS);
+ break;
+ case(TS_PREC_FIXED_CSEC):
+ case(TS_PREC_AUTO_CSEC):
+ display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ fd->rel_ts.secs, fd->rel_ts.nsecs / 10000000, CSECS);
+ break;
+ case(TS_PREC_FIXED_MSEC):
+ case(TS_PREC_AUTO_MSEC):
+ display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ fd->rel_ts.secs, fd->rel_ts.nsecs / 1000000, MSECS);
+ break;
+ case(TS_PREC_FIXED_USEC):
+ case(TS_PREC_AUTO_USEC):
+ display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ fd->rel_ts.secs, fd->rel_ts.nsecs / 1000, USECS);
+ break;
+ case(TS_PREC_FIXED_NSEC):
+ case(TS_PREC_AUTO_NSEC):
+ display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ fd->rel_ts.secs, fd->rel_ts.nsecs, NSECS);
+ break;
+ default:
+ g_assert_not_reached();
+ }
cinfo->col_data[col] = cinfo->col_buf[col];
strcpy(cinfo->col_expr[col],"frame.time_relative");
strcpy(cinfo->col_expr_val[col],cinfo->col_buf[col]);
static void
col_set_delta_time(frame_data *fd, column_info *cinfo, int col)
{
- display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
- fd->del_ts.secs, fd->del_ts.nsecs / 1000, USECS);
+ switch(timestamp_get_precision()) {
+ case(TS_PREC_FIXED_SEC):
+ case(TS_PREC_AUTO_SEC):
+ display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ fd->del_ts.secs, fd->del_ts.nsecs / 1000000000, SECS);
+ break;
+ case(TS_PREC_FIXED_DSEC):
+ case(TS_PREC_AUTO_DSEC):
+ display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ fd->del_ts.secs, fd->del_ts.nsecs / 100000000, DSECS);
+ break;
+ case(TS_PREC_FIXED_CSEC):
+ case(TS_PREC_AUTO_CSEC):
+ display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ fd->del_ts.secs, fd->del_ts.nsecs / 10000000, CSECS);
+ break;
+ case(TS_PREC_FIXED_MSEC):
+ case(TS_PREC_AUTO_MSEC):
+ display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ fd->del_ts.secs, fd->del_ts.nsecs / 1000000, MSECS);
+ break;
+ case(TS_PREC_FIXED_USEC):
+ case(TS_PREC_AUTO_USEC):
+ display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ fd->del_ts.secs, fd->del_ts.nsecs / 1000, USECS);
+ break;
+ case(TS_PREC_FIXED_NSEC):
+ case(TS_PREC_AUTO_NSEC):
+ display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ fd->del_ts.secs, fd->del_ts.nsecs, NSECS);
+ break;
+ default:
+ g_assert_not_reached();
+ }
cinfo->col_data[col] = cinfo->col_buf[col];
strcpy(cinfo->col_expr[col],"frame.time_delta");
strcpy(cinfo->col_expr_val[col],cinfo->col_buf[col]);
then = fd->abs_ts.secs;
tmp = localtime(&then);
if (tmp != NULL) {
- g_snprintf(cinfo->col_buf[col], COL_MAX_LEN, "%02d:%02d:%02d.%06ld",
+ switch(timestamp_get_precision()) {
+ case(TS_PREC_FIXED_SEC):
+ case(TS_PREC_AUTO_SEC):
+ g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
+ "%02d:%02d:%02d",
+ tmp->tm_hour,
+ tmp->tm_min,
+ tmp->tm_sec);
+ break;
+ case(TS_PREC_FIXED_DSEC):
+ case(TS_PREC_AUTO_DSEC):
+ g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
+ "%02d:%02d:%02d.%01ld",
+ tmp->tm_hour,
+ tmp->tm_min,
+ tmp->tm_sec,
+ (long)fd->abs_ts.nsecs / 100000000);
+ break;
+ case(TS_PREC_FIXED_CSEC):
+ case(TS_PREC_AUTO_CSEC):
+ g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
+ "%02d:%02d:%02d.%02ld",
+ tmp->tm_hour,
+ tmp->tm_min,
+ tmp->tm_sec,
+ (long)fd->abs_ts.nsecs / 10000000);
+ break;
+ case(TS_PREC_FIXED_MSEC):
+ case(TS_PREC_AUTO_MSEC):
+ g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
+ "%02d:%02d:%02d.%03ld",
+ tmp->tm_hour,
+ tmp->tm_min,
+ tmp->tm_sec,
+ (long)fd->abs_ts.nsecs / 1000000);
+ break;
+ case(TS_PREC_FIXED_USEC):
+ case(TS_PREC_AUTO_USEC):
+ g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
+ "%02d:%02d:%02d.%06ld",
+ tmp->tm_hour,
+ tmp->tm_min,
+ tmp->tm_sec,
+ (long)fd->abs_ts.nsecs / 1000);
+ break;
+ case(TS_PREC_FIXED_NSEC):
+ case(TS_PREC_AUTO_NSEC):
+ g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
+ "%02d:%02d:%02d.%09ld",
tmp->tm_hour,
tmp->tm_min,
tmp->tm_sec,
- (long)fd->abs_ts.nsecs / 1000); /* XXX - this has to be improved */
+ (long)fd->abs_ts.nsecs);
+ break;
+ default:
+ g_assert_not_reached();
+ }
} else {
cinfo->col_buf[col][0] = '\0';
}
void
col_set_cls_time(frame_data *fd, column_info *cinfo, int col)
{
- switch (get_timestamp_setting()) {
+ switch (timestamp_get_type()) {
case TS_ABSOLUTE:
col_set_abs_time(fd, cinfo, col);
break;
}
}
+/* Returns a string representing the longest possible value for
+ a timestamp column type. */
+static const char *
+get_timestamp_column_longest_string(gint type, gint precision)
+{
+
+ switch(type) {
+ case(TS_ABSOLUTE_WITH_DATE):
+ switch(precision) {
+ case(TS_PREC_AUTO_SEC):
+ case(TS_PREC_FIXED_SEC):
+ return "0000-00-00 00:00:00";
+ break;
+ case(TS_PREC_AUTO_DSEC):
+ case(TS_PREC_FIXED_DSEC):
+ return "0000-00-00 00:00:00.0";
+ break;
+ case(TS_PREC_AUTO_CSEC):
+ case(TS_PREC_FIXED_CSEC):
+ return "0000-00-00 00:00:00.00";
+ break;
+ case(TS_PREC_AUTO_MSEC):
+ case(TS_PREC_FIXED_MSEC):
+ return "0000-00-00 00:00:00.000";
+ break;
+ case(TS_PREC_AUTO_USEC):
+ case(TS_PREC_FIXED_USEC):
+ return "0000-00-00 00:00:00.000000";
+ break;
+ case(TS_PREC_AUTO_NSEC):
+ case(TS_PREC_FIXED_NSEC):
+ return "0000-00-00 00:00:00.000000000";
+ break;
+ default:
+ g_assert_not_reached();
+ }
+ break;
+ case(TS_ABSOLUTE):
+ switch(precision) {
+ case(TS_PREC_AUTO_SEC):
+ case(TS_PREC_FIXED_SEC):
+ return "00:00:00";
+ break;
+ case(TS_PREC_AUTO_DSEC):
+ case(TS_PREC_FIXED_DSEC):
+ return "00:00:00.0";
+ break;
+ case(TS_PREC_AUTO_CSEC):
+ case(TS_PREC_FIXED_CSEC):
+ return "00:00:00.00";
+ break;
+ case(TS_PREC_AUTO_MSEC):
+ case(TS_PREC_FIXED_MSEC):
+ return "00:00:00.000";
+ break;
+ case(TS_PREC_AUTO_USEC):
+ case(TS_PREC_FIXED_USEC):
+ return "00:00:00.000000";
+ break;
+ case(TS_PREC_AUTO_NSEC):
+ case(TS_PREC_FIXED_NSEC):
+ return "00:00:00.000000000";
+ break;
+ default:
+ g_assert_not_reached();
+ }
+ break;
+ case(TS_RELATIVE): /* fallthrough */
+ case(TS_DELTA):
+ switch(precision) {
+ case(TS_PREC_AUTO_SEC):
+ case(TS_PREC_FIXED_SEC):
+ return "0000";
+ break;
+ case(TS_PREC_AUTO_DSEC):
+ case(TS_PREC_FIXED_DSEC):
+ return "0000.0";
+ break;
+ case(TS_PREC_AUTO_CSEC):
+ case(TS_PREC_FIXED_CSEC):
+ return "0000.00";
+ break;
+ case(TS_PREC_AUTO_MSEC):
+ case(TS_PREC_FIXED_MSEC):
+ return "0000.000";
+ break;
+ case(TS_PREC_AUTO_USEC):
+ case(TS_PREC_FIXED_USEC):
+ return "0000.000000";
+ break;
+ case(TS_PREC_AUTO_NSEC):
+ case(TS_PREC_FIXED_NSEC):
+ return "0000.000000000";
+ break;
+ default:
+ g_assert_not_reached();
+ }
+ break;
+ case(TS_NOT_SET):
+ return "0000.000000";
+ break;
+ default:
+ g_assert_not_reached();
+ }
+
+ /* never reached, satisfy compiler */
+ return "";
+}
+
/* Returns a string representing the longest possible value for a
particular column type.
return "0000000";
break;
case COL_CLS_TIME:
- if (get_timestamp_setting() == TS_ABSOLUTE)
- return "00:00:00.000000";
- else if (get_timestamp_setting() == TS_ABSOLUTE_WITH_DATE)
- return "0000-00-00 00:00:00.000000";
- else
- return "0000.000000";
- break;
- case COL_ABS_TIME:
- return "00:00:00.000000";
+ return get_timestamp_column_longest_string(timestamp_get_type(), timestamp_get_precision());
break;
case COL_ABS_DATE_TIME:
- return "0000-00-00 00:00:00.000000";
+ return get_timestamp_column_longest_string(TS_ABSOLUTE_WITH_DATE, timestamp_get_precision());
+ break;
+ case COL_ABS_TIME:
+ return get_timestamp_column_longest_string(TS_ABSOLUTE, timestamp_get_precision());
break;
case COL_REL_TIME:
+ return get_timestamp_column_longest_string(TS_RELATIVE, timestamp_get_precision());
+ break;
case COL_DELTA_TIME:
- return "0000.000000";
+ return get_timestamp_column_longest_string(TS_DELTA, timestamp_get_precision());
break;
case COL_DEF_SRC:
case COL_RES_SRC:
get_systemfile_dir
get_tcp_port
get_tempfile_path
-get_timestamp_setting
get_udp_port
gsm_a_bssmap_msg_strings DATA
gsm_a_dtap_msg_cc_strings DATA
rtp_payload_type_vals DATA
rtp_payload_type_short_vals DATA
set_actual_length
-set_timestamp_setting
show_fragment_seq_tree
show_fragment_tree
sid_name_snooping DATA
test_for_fifo
time_msecs_to_str
time_secs_to_str
+timestamp_get_precision
+timestamp_get_type
+timestamp_set_precision
+timestamp_set_type
trans2_cmd_vals DATA
tree_is_expanded DATA
tvb_bytes_exist
* and distinguish it from a command line value */
static ts_type timestamp_type = TS_NOT_SET;
-ts_type get_timestamp_setting(void)
+static int timestamp_precision = TS_PREC_AUTO_USEC;
+
+ts_type timestamp_get_type(void)
{
return timestamp_type;
}
-void set_timestamp_setting(ts_type ts_t)
+void timestamp_set_type(ts_type ts_t)
{
timestamp_type = ts_t;
}
+
+
+int timestamp_get_precision(void)
+{
+ return timestamp_precision;
+}
+
+void timestamp_set_precision(int tsp)
+{
+ timestamp_precision = tsp;
+}
+
TS_RELATIVE,
TS_ABSOLUTE,
TS_ABSOLUTE_WITH_DATE,
- TS_DELTA
-} ts_type;
-
+ TS_DELTA,
/*
* Special value used for the command-line setting in Ethereal, to indicate
* that no value has been set from the command line.
*/
-#define TS_NOT_SET ((ts_type)-1)
+ TS_NOT_SET
+} ts_type;
+
+typedef enum {
+ TS_PREC_AUTO, /* recent */
+ TS_PREC_FIXED_SEC, /* recent and internal */
+ TS_PREC_FIXED_DSEC, /* recent and internal */
+ TS_PREC_FIXED_CSEC, /* recent and internal */
+ TS_PREC_FIXED_MSEC, /* recent and internal */
+ TS_PREC_FIXED_USEC, /* recent and internal */
+ TS_PREC_FIXED_NSEC, /* recent and internal */
+ TS_PREC_AUTO_SEC, /* internal */
+ TS_PREC_AUTO_DSEC, /* internal */
+ TS_PREC_AUTO_CSEC, /* internal */
+ TS_PREC_AUTO_MSEC, /* internal */
+ TS_PREC_AUTO_USEC, /* internal */
+ TS_PREC_AUTO_NSEC /* internal */
+} ts_precision;
+
+extern ts_type timestamp_get_type(void);
+extern void timestamp_set_type(ts_type);
-extern ts_type get_timestamp_setting(void);
-extern void set_timestamp_setting(ts_type);
+extern int timestamp_get_precision(void);
+extern void timestamp_set_precision(int tsp);
#endif /* timestamp.h */
}
switch (units) {
+ case SECS:
+ g_snprintf(buf, buflen, "%s%d", sign, sec);
+ break;
+
+ case DSECS:
+ g_snprintf(buf, buflen, "%s%d.%01d", sign, sec, frac);
+ break;
+
+ case CSECS:
+ g_snprintf(buf, buflen, "%s%d.%02d", sign, sec, frac);
+ break;
+
case MSECS:
g_snprintf(buf, buflen, "%s%d.%03d", sign, sec, frac);
break;
* Resolution of a time stamp.
*/
typedef enum {
+ SECS, /* seconds */
+ DSECS, /* deciseconds */
+ CSECS, /* centiseconds */
MSECS, /* milliseconds */
USECS, /* microseconds */
NSECS /* nanoseconds */
#include "stat_menu.h"
#include "tap_dfilter_dlg.h"
#include <epan/dissectors/packet-data.h>
+#include <epan/timestamp.h>
+
/* Win32 needs the O_BINARY flag for open() */
#ifndef O_BINARY
cf_cb_user_data = NULL;
}
+void
+cf_timestamp_auto_precision(capture_file *cf)
+{
+ int prec = timestamp_get_precision();
+
+
+ /* don't try to get the file's precision if none is opened */
+ if(cf->state == FILE_CLOSED) {
+ return;
+ }
+
+ /* if we are in auto mode, set precision of current file */
+ if(prec == TS_PREC_AUTO ||
+ prec == TS_PREC_AUTO_SEC ||
+ prec == TS_PREC_AUTO_DSEC ||
+ prec == TS_PREC_AUTO_CSEC ||
+ prec == TS_PREC_AUTO_MSEC ||
+ prec == TS_PREC_AUTO_USEC ||
+ prec == TS_PREC_AUTO_NSEC)
+ {
+ switch(wtap_file_tsprecision(cf->wth)) {
+ case(WTAP_FILE_TSPREC_SEC):
+ timestamp_set_precision(TS_PREC_AUTO_SEC);
+ break;
+ case(WTAP_FILE_TSPREC_DSEC):
+ timestamp_set_precision(TS_PREC_AUTO_DSEC);
+ break;
+ case(WTAP_FILE_TSPREC_CSEC):
+ timestamp_set_precision(TS_PREC_AUTO_CSEC);
+ break;
+ case(WTAP_FILE_TSPREC_MSEC):
+ timestamp_set_precision(TS_PREC_AUTO_MSEC);
+ break;
+ case(WTAP_FILE_TSPREC_USEC):
+ timestamp_set_precision(TS_PREC_AUTO_USEC);
+ break;
+ case(WTAP_FILE_TSPREC_NSEC):
+ timestamp_set_precision(TS_PREC_AUTO_NSEC);
+ break;
+ default:
+ g_assert_not_reached();
+ }
+ }
+}
+
cf_status_t
cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
cf->user_saved = !is_tempfile;
cf->cd_t = wtap_file_type(cf->wth);
- cf->tsprecision = wtap_file_tsprecision(cf->wth);
cf->count = 0;
cf->displayed_count = 0;
cf->marked_count = 0;
G_ALLOC_AND_FREE);
g_assert(cf->plist_chunk);
+ /* change the time formats now, as we might have a new precision */
+ cf_change_time_formats(cf);
+
fileset_file_opened(fname);
return CF_OK;
int first, last;
gboolean sorted_by_frame_column;
+
+ /* adjust timestamp precision if auto is selected */
+ cf_timestamp_auto_precision(cf);
+
/* Are there any columns with time stamps in the "command-line-specified"
format?
break;
case 't': /* Time stamp type */
if (strcmp(optarg, "r") == 0)
- set_timestamp_setting(TS_RELATIVE);
+ timestamp_set_type(TS_RELATIVE);
else if (strcmp(optarg, "a") == 0)
- set_timestamp_setting(TS_ABSOLUTE);
+ timestamp_set_type(TS_ABSOLUTE);
else if (strcmp(optarg, "ad") == 0)
- set_timestamp_setting(TS_ABSOLUTE_WITH_DATE);
+ timestamp_set_type(TS_ABSOLUTE_WITH_DATE);
else if (strcmp(optarg, "d") == 0)
- set_timestamp_setting(TS_DELTA);
+ timestamp_set_type(TS_DELTA);
else {
fprintf(stderr, "ethereal: Invalid time stamp type \"%s\"\n",
optarg);
static void timestamp_absolute_date_cb(GtkWidget *w _U_, gpointer d _U_);
static void timestamp_relative_cb(GtkWidget *w _U_, gpointer d _U_);
static void timestamp_delta_cb(GtkWidget *w _U_, gpointer d _U_);
+static void timestamp_auto_cb(GtkWidget *w _U_, gpointer d _U_);
+static void timestamp_sec_cb(GtkWidget *w _U_, gpointer d _U_);
+static void timestamp_dsec_cb(GtkWidget *w _U_, gpointer d _U_);
+static void timestamp_csec_cb(GtkWidget *w _U_, gpointer d _U_);
+static void timestamp_msec_cb(GtkWidget *w _U_, gpointer d _U_);
+static void timestamp_usec_cb(GtkWidget *w _U_, gpointer d _U_);
+static void timestamp_nsec_cb(GtkWidget *w _U_, gpointer d _U_);
static void name_resolution_mac_cb(GtkWidget *w _U_, gpointer d _U_);
static void name_resolution_network_cb(GtkWidget *w _U_, gpointer d _U_);
static void name_resolution_transport_cb(GtkWidget *w _U_, gpointer d _U_);
ITEM_FACTORY_ENTRY("/View/Packet _Bytes", NULL, byte_view_show_cb, 0, "<CheckItem>", NULL),
ITEM_FACTORY_ENTRY("/View/<separator>", NULL, NULL, 0, "<Separator>", NULL),
ITEM_FACTORY_ENTRY("/View/_Time Display Format", NULL, NULL, 0, "<Branch>", NULL),
- ITEM_FACTORY_ENTRY("/View/Time Display Format/Time of Day", NULL, timestamp_absolute_cb,
+ ITEM_FACTORY_ENTRY("/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL, timestamp_absolute_date_cb,
0, "<RadioItem>", NULL),
- ITEM_FACTORY_ENTRY("/View/Time Display Format/Date and Time of Day", NULL, timestamp_absolute_date_cb,
- 0, "/View/Time Display Format/Time of Day", NULL),
- ITEM_FACTORY_ENTRY("/View/Time Display Format/Seconds Since Beginning of Capture", NULL, timestamp_relative_cb,
- 0, "/View/Time Display Format/Time of Day", NULL),
- ITEM_FACTORY_ENTRY("/View/Time Display Format/Seconds Since Previous Packet", NULL, timestamp_delta_cb,
- 0, "/View/Time Display Format/Time of Day", NULL),
+ ITEM_FACTORY_ENTRY("/View/Time Display Format/Time of Day: 01:02:03.123456", NULL, timestamp_absolute_cb,
+ 0, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL),
+ ITEM_FACTORY_ENTRY("/View/Time Display Format/Seconds Since Beginning of Capture: 123.123456", NULL, timestamp_relative_cb,
+ 0, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL),
+ ITEM_FACTORY_ENTRY("/View/Time Display Format/Seconds Since Previous Packet: 1.123456", NULL, timestamp_delta_cb,
+ 0, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL),
+ ITEM_FACTORY_ENTRY("/View/Time Display Format/<separator>", NULL, NULL, 0, "<Separator>", NULL),
+ ITEM_FACTORY_ENTRY("/View/Time Display Format/Automatic (File Format Precision)", NULL, timestamp_auto_cb,
+ 0, "<RadioItem>", NULL),
+ ITEM_FACTORY_ENTRY("/View/Time Display Format/Seconds: 0", NULL, timestamp_sec_cb,
+ 0, "/View/Time Display Format/Automatic (File Format Precision)", NULL),
+ ITEM_FACTORY_ENTRY("/View/Time Display Format/Deciseconds: 0.1", NULL, timestamp_dsec_cb,
+ 0, "/View/Time Display Format/Automatic (File Format Precision)", NULL),
+ ITEM_FACTORY_ENTRY("/View/Time Display Format/Centiseconds: 0.12", NULL, timestamp_csec_cb,
+ 0, "/View/Time Display Format/Automatic (File Format Precision)", NULL),
+ ITEM_FACTORY_ENTRY("/View/Time Display Format/Milliseconds: 0.123", NULL, timestamp_msec_cb,
+ 0, "/View/Time Display Format/Automatic (File Format Precision)", NULL),
+ ITEM_FACTORY_ENTRY("/View/Time Display Format/Microseconds: 0.123456", NULL, timestamp_usec_cb,
+ 0, "/View/Time Display Format/Automatic (File Format Precision)", NULL),
+ ITEM_FACTORY_ENTRY("/View/Time Display Format/Nanoseconds: 0.123456789", NULL, timestamp_nsec_cb,
+ 0, "/View/Time Display Format/Automatic (File Format Precision)", NULL),
ITEM_FACTORY_ENTRY("/View/Name Resol_ution", NULL, NULL, 0, "<Branch>", NULL),
ITEM_FACTORY_ENTRY("/View/Name Resolution/_Resolve Name", NULL, resolve_name_cb, 0, NULL, NULL),
ITEM_FACTORY_ENTRY("/View/Name Resolution/<separator>", NULL, NULL, 0, "<Separator>", NULL),
timestamp_absolute_cb(GtkWidget *w _U_, gpointer d _U_)
{
if (recent.gui_time_format != TS_ABSOLUTE) {
- set_timestamp_setting(TS_ABSOLUTE);
+ timestamp_set_type(TS_ABSOLUTE);
recent.gui_time_format = TS_ABSOLUTE;
cf_change_time_formats(&cfile);
}
timestamp_absolute_date_cb(GtkWidget *w _U_, gpointer d _U_)
{
if (recent.gui_time_format != TS_ABSOLUTE_WITH_DATE) {
- set_timestamp_setting(TS_ABSOLUTE_WITH_DATE);
+ timestamp_set_type(TS_ABSOLUTE_WITH_DATE);
recent.gui_time_format = TS_ABSOLUTE_WITH_DATE;
cf_change_time_formats(&cfile);
}
timestamp_relative_cb(GtkWidget *w _U_, gpointer d _U_)
{
if (recent.gui_time_format != TS_RELATIVE) {
- set_timestamp_setting(TS_RELATIVE);
+ timestamp_set_type(TS_RELATIVE);
recent.gui_time_format = TS_RELATIVE;
cf_change_time_formats(&cfile);
}
timestamp_delta_cb(GtkWidget *w _U_, gpointer d _U_)
{
if (recent.gui_time_format != TS_DELTA) {
- set_timestamp_setting(TS_DELTA);
+ timestamp_set_type(TS_DELTA);
recent.gui_time_format = TS_DELTA;
cf_change_time_formats(&cfile);
}
}
+static void
+timestamp_auto_cb(GtkWidget *w _U_, gpointer d _U_)
+{
+ if (recent.gui_time_precision != TS_PREC_AUTO) {
+ /* the actual precision will be set in cf_change_time_formats() below */
+ timestamp_set_precision(TS_PREC_AUTO_SEC);
+ recent.gui_time_precision = TS_PREC_AUTO;
+ cf_change_time_formats(&cfile);
+ }
+}
+
+static void
+timestamp_sec_cb(GtkWidget *w _U_, gpointer d _U_)
+{
+ if (recent.gui_time_precision != TS_PREC_FIXED_SEC) {
+ timestamp_set_precision(TS_PREC_FIXED_SEC);
+ recent.gui_time_precision = TS_PREC_FIXED_SEC;
+ cf_change_time_formats(&cfile);
+ }
+}
+
+static void
+timestamp_dsec_cb(GtkWidget *w _U_, gpointer d _U_)
+{
+ if (recent.gui_time_precision != TS_PREC_FIXED_DSEC) {
+ timestamp_set_precision(TS_PREC_FIXED_DSEC);
+ recent.gui_time_precision = TS_PREC_FIXED_DSEC;
+ cf_change_time_formats(&cfile);
+ }
+}
+
+static void
+timestamp_csec_cb(GtkWidget *w _U_, gpointer d _U_)
+{
+ if (recent.gui_time_precision != TS_PREC_FIXED_CSEC) {
+ timestamp_set_precision(TS_PREC_FIXED_CSEC);
+ recent.gui_time_precision = TS_PREC_FIXED_CSEC;
+ cf_change_time_formats(&cfile);
+ }
+}
+
+static void
+timestamp_msec_cb(GtkWidget *w _U_, gpointer d _U_)
+{
+ if (recent.gui_time_precision != TS_PREC_FIXED_MSEC) {
+ timestamp_set_precision(TS_PREC_FIXED_MSEC);
+ recent.gui_time_precision = TS_PREC_FIXED_MSEC;
+ cf_change_time_formats(&cfile);
+ }
+}
+
+static void
+timestamp_usec_cb(GtkWidget *w _U_, gpointer d _U_)
+{
+ if (recent.gui_time_precision != TS_PREC_FIXED_USEC) {
+ timestamp_set_precision(TS_PREC_FIXED_USEC);
+ recent.gui_time_precision = TS_PREC_FIXED_USEC;
+ cf_change_time_formats(&cfile);
+ }
+}
+
+static void
+timestamp_nsec_cb(GtkWidget *w _U_, gpointer d _U_)
+{
+ if (recent.gui_time_precision != TS_PREC_FIXED_NSEC) {
+ timestamp_set_precision(TS_PREC_FIXED_NSEC);
+ recent.gui_time_precision = TS_PREC_FIXED_NSEC;
+ cf_change_time_formats(&cfile);
+ }
+}
+
+
void
menu_name_resolution_changed(void)
{
main_widgets_rearrange();
/* don't change the time format, if we had a command line value */
- if (get_timestamp_setting() != TS_NOT_SET) {
- recent.gui_time_format = get_timestamp_setting();
+ if (timestamp_get_type() != TS_NOT_SET) {
+ recent.gui_time_format = timestamp_get_type();
}
switch(recent.gui_time_format) {
- case(TS_ABSOLUTE):
+ case(TS_ABSOLUTE_WITH_DATE):
menu = gtk_item_factory_get_widget(main_menu_factory,
- "/View/Time Display Format/Time of Day");
+ "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456");
/* set_active will not trigger the callback when activating an active item! */
recent.gui_time_format = -1;
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
break;
- case(TS_ABSOLUTE_WITH_DATE):
+ case(TS_ABSOLUTE):
menu = gtk_item_factory_get_widget(main_menu_factory,
- "/View/Time Display Format/Date and Time of Day");
+ "/View/Time Display Format/Time of Day: 01:02:03.123456");
+ /* set_active will not trigger the callback when activating an active item! */
recent.gui_time_format = -1;
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
break;
case(TS_RELATIVE):
menu = gtk_item_factory_get_widget(main_menu_factory,
- "/View/Time Display Format/Seconds Since Beginning of Capture");
+ "/View/Time Display Format/Seconds Since Beginning of Capture: 123.123456");
recent.gui_time_format = -1;
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
break;
case(TS_DELTA):
menu = gtk_item_factory_get_widget(main_menu_factory,
- "/View/Time Display Format/Seconds Since Previous Packet");
+ "/View/Time Display Format/Seconds Since Previous Packet: 1.123456");
recent.gui_time_format = -1;
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
break;
g_assert_not_reached();
}
+ switch(recent.gui_time_precision) {
+ case(TS_PREC_AUTO):
+ menu = gtk_item_factory_get_widget(main_menu_factory,
+ "/View/Time Display Format/Automatic (File Format Precision)");
+ /* set_active will not trigger the callback when activating an active item! */
+ recent.gui_time_precision = -1;
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
+ break;
+ case(TS_PREC_FIXED_SEC):
+ menu = gtk_item_factory_get_widget(main_menu_factory,
+ "/View/Time Display Format/Seconds: 0");
+ recent.gui_time_precision = -1;
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
+ break;
+ case(TS_PREC_FIXED_DSEC):
+ menu = gtk_item_factory_get_widget(main_menu_factory,
+ "/View/Time Display Format/Deciseconds: 0.1");
+ recent.gui_time_precision = -1;
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
+ break;
+ case(TS_PREC_FIXED_CSEC):
+ menu = gtk_item_factory_get_widget(main_menu_factory,
+ "/View/Time Display Format/Centiseconds: 0.12");
+ recent.gui_time_precision = -1;
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
+ break;
+ case(TS_PREC_FIXED_MSEC):
+ menu = gtk_item_factory_get_widget(main_menu_factory,
+ "/View/Time Display Format/Milliseconds: 0.123");
+ recent.gui_time_precision = -1;
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
+ break;
+ case(TS_PREC_FIXED_USEC):
+ menu = gtk_item_factory_get_widget(main_menu_factory,
+ "/View/Time Display Format/Microseconds: 0.123456");
+ recent.gui_time_precision = -1;
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
+ break;
+ case(TS_PREC_FIXED_NSEC):
+ menu = gtk_item_factory_get_widget(main_menu_factory,
+ "/View/Time Display Format/Nanoseconds: 0.123456789");
+ recent.gui_time_precision = -1;
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
+ break;
+ default:
+ g_assert_not_reached();
+ }
+
menu_colorize_changed(recent.packet_list_colorize);
}
return COMPARE_FRAME_NUM();
case COL_CLS_TIME:
- switch (get_timestamp_setting()) {
+ switch (timestamp_get_type()) {
case TS_ABSOLUTE:
case TS_ABSOLUTE_WITH_DATE:
#define RECENT_KEY_STATUSBAR_SHOW "gui.statusbar_show"
#define RECENT_KEY_PACKET_LIST_COLORIZE "gui.packet_list_colorize"
#define RECENT_GUI_TIME_FORMAT "gui.time_format"
+#define RECENT_GUI_TIME_PRECISION "gui.time_precision"
#define RECENT_GUI_ZOOM_LEVEL "gui.zoom_level"
#define RECENT_GUI_GEOMETRY_MAIN_X "gui.geometry_main_x"
#define RECENT_GUI_GEOMETRY_MAIN_Y "gui.geometry_main_y"
static const char *ts_type_text[] =
{ "RELATIVE", "ABSOLUTE", "ABSOLUTE_WITH_DATE", "DELTA", NULL };
+static const char *ts_precision_text[] =
+ { "AUTO", "SEC", "DSEC", "CSEC", "MSEC", "USEC", "NSEC", NULL };
+
/* Takes an string and a pointer to an array of strings, and a default int value.
* The array must be terminated by a NULL string. If the string is found in the array
* of strings, the index of that string in the array is returned. Otherwise, the
fprintf(rf, RECENT_GUI_TIME_FORMAT ": %s\n",
ts_type_text[recent.gui_time_format]);
+ fprintf(rf, "\n# Timestamp display precision.\n");
+ fprintf(rf, "# One of: AUTO, SEC, DSEC, CSEC, MSEC, USEC, NSEC\n");
+ fprintf(rf, RECENT_GUI_TIME_PRECISION ": %s\n",
+ ts_precision_text[recent.gui_time_precision]);
+
fprintf(rf, "\n# Zoom level.\n");
fprintf(rf, "# A decimal number.\n");
fprintf(rf, RECENT_GUI_ZOOM_LEVEL ": %d\n",
} else if (strcmp(key, RECENT_GUI_TIME_FORMAT) == 0) {
recent.gui_time_format =
find_index_from_string_array(value, ts_type_text, TS_RELATIVE);
+ } else if (strcmp(key, RECENT_GUI_TIME_PRECISION) == 0) {
+ recent.gui_time_precision =
+ find_index_from_string_array(value, ts_precision_text, TS_PREC_AUTO);
} else if (strcmp(key, RECENT_GUI_ZOOM_LEVEL) == 0) {
num = strtol(value, &p, 0);
if (p == value || *p != '\0')
recent.statusbar_show = TRUE;
recent.packet_list_colorize = TRUE;
recent.gui_time_format = TS_RELATIVE;
+ recent.gui_time_precision = TS_PREC_AUTO;
recent.gui_zoom_level = 0;
recent.gui_geometry_main_x = 20;
gboolean statusbar_show;
gboolean packet_list_colorize;
gint gui_time_format;
+ gint gui_time_precision;
gint gui_zoom_level;
gint gui_geometry_main_x;
capture_opts_init(&capture_opts, NULL /* cfile */);
#endif
- set_timestamp_setting(TS_RELATIVE);
+ timestamp_set_type(TS_RELATIVE);
+ timestamp_set_precision(TS_PREC_AUTO);
/* Register all dissectors; we must do this before checking for the
"-G" flag, as the "-G" flag dumps information registered by the
break;
case 't': /* Time stamp type */
if (strcmp(optarg, "r") == 0)
- set_timestamp_setting(TS_RELATIVE);
+ timestamp_set_type(TS_RELATIVE);
else if (strcmp(optarg, "a") == 0)
- set_timestamp_setting(TS_ABSOLUTE);
+ timestamp_set_type(TS_ABSOLUTE);
else if (strcmp(optarg, "ad") == 0)
- set_timestamp_setting(TS_ABSOLUTE_WITH_DATE);
+ timestamp_set_type(TS_ABSOLUTE_WITH_DATE);
else if (strcmp(optarg, "d") == 0)
- set_timestamp_setting(TS_DELTA);
+ timestamp_set_type(TS_DELTA);
else {
fprintf(stderr, "tethereal: Invalid time stamp type \"%s\"\n",
optarg);
wth->subtype_seek_read = _5views_seek_read;
wth->file_encap = encap;
wth->snapshot_length = 0; /* not available in header */
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
return 1;
}
wth->subtype_read = airopeekv9_read;
wth->subtype_seek_read = airopeekv9_seek_read;
wth->subtype_close = airopeekv9_close;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
wth->capture.airopeek9 = g_malloc(sizeof(airopeek9_t));
switch (mediaSubType) {
}
wth->capture.ascend->inittime = statbuf.st_ctime;
wth->capture.ascend->adjusted = 0;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
init_parse_ascend();
wth->snapshot_length = 0; /* not known */
wth->subtype_read = cosine_read;
wth->subtype_seek_read = cosine_seek_read;
+ wth->tsprecision = WTAP_FILE_TSPREC_CSEC;
return 1;
}
wth->subtype_read = csids_read;
wth->subtype_seek_read = csids_seek_read;
wth->subtype_close = csids_close;
+ wth->tsprecision = WTAP_FILE_TSPREC_SEC;
return 1;
}
wth->snapshot_length = 0; /* not known */
wth->subtype_read = dbs_etherwatch_read;
wth->subtype_seek_read = dbs_etherwatch_seek_read;
+ wth->tsprecision = WTAP_FILE_TSPREC_CSEC;
return 1;
}
wth->subtype_read = erf_read;
wth->subtype_seek_read = erf_seek_read;
wth->subtype_close = erf_close;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
return 1;
}
}
wth->snapshot_length = 0; /* not available in header */
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
return 1;
}
wth->snapshot_length = 0; /* not known */
wth->subtype_read = eyesdn_read;
wth->subtype_seek_read = eyesdn_seek_read;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
return 1;
}
wth->subtype_read = hcidump_read;
wth->subtype_seek_read = hcidump_seek_read;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
return 1;
}
wth->capture.i4btrace->byte_swapped = byte_swapped;
wth->file_encap = WTAP_ENCAP_ISDN;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
return 1;
}
wth->file_type = WTAP_FILE_IPTRACE_1_0;
wth->subtype_read = iptrace_read_1_0;
wth->subtype_seek_read = iptrace_seek_read_1_0;
+ wth->tsprecision = WTAP_FILE_TSPREC_SEC;
}
else if (strcmp(name, "iptrace 2.0") == 0) {
wth->file_type = WTAP_FILE_IPTRACE_2_0;
wth->subtype_read = iptrace_read_2_0;
wth->subtype_seek_read = iptrace_seek_read_2_0;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
}
else {
return 0;
wth->subtype_seek_read = k12_seek_read;
wth->subtype_close = k12_close;
wth->capture.k12 = file_data;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
/* if we use just one encapsulation for all the file
we will use that for the whole file so we can
wth->subtype_seek_read = lanalyzer_seek_read;
wth->subtype_close = lanalyzer_close;
wth->snapshot_length = 0;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
/* Read records until we find the start of packets */
while (1) {
int file_encap;
- /* XXX - this must be done depending on the magic number */
- /*wth->tsrecision = WTAP_FILE_TSPREC_NSEC;*/
-
/* Read in the number that should be at the start of a "libpcap" file */
errno = WTAP_ERR_CANT_READ;
bytes_read = file_read(&magic, 1, sizeof magic, wth->fh);
a program using either standard or ss990417 libpcap. */
byte_swapped = FALSE;
modified = FALSE;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
break;
case PCAP_MODIFIED_MAGIC:
a program using either ss990915 or ss991029 libpcap. */
byte_swapped = FALSE;
modified = TRUE;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
break;
case PCAP_SWAPPED_MAGIC:
ss990417 libpcap. */
byte_swapped = TRUE;
modified = FALSE;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
break;
case PCAP_SWAPPED_MODIFIED_MAGIC:
or ss991029 libpcap. */
byte_swapped = TRUE;
modified = TRUE;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
break;
default:
/* Set up to start reading at the first frame. */
wth->capture.netmon->current_frame = 0;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
return 1;
}
return -1;
}
wth->data_offset = FILE_HDR_SIZE;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
return 1;
}
wth->subtype_close = NULL;
wth->subtype_sequential_close = NULL;
wth->snapshot_length = 0;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
/* reset the pointer to the first packet */
if (file_seek(wth->fh, file_header.offset_to_first_packet, SEEK_SET,
case WTAP_FILE_NETXRAY_OLD:
timeunit = 1000.0;
+ wth->tsprecision = WTAP_FILE_TSPREC_MSEC;
break;
case WTAP_FILE_NETXRAY_1_0:
timeunit = 1000.0;
+ wth->tsprecision = WTAP_FILE_TSPREC_MSEC;
break;
case WTAP_FILE_NETXRAY_1_1:
* and older versions of Windows Sniffer.
*/
timeunit = 1000000.0;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
break;
case WTAP_FILE_NETXRAY_2_00x:
return -1;
}
timeunit = TpS[hdr.timeunit];
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC; /* XXX */
break;
case ETH_CAPTYPE_GIGPOD:
return -1;
}
timeunit = TpS_gigpod[hdr.timeunit];
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC; /* XXX */
/*
* At least for 002.002 and 002.003
return -1;
}
timeunit = TpS_otherpod[hdr.timeunit];
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC; /* XXX */
/*
* At least for 002.002 and 002.003
return -1;
}
timeunit = TpS_gigpod2[hdr.timeunit];
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC; /* XXX */
break;
default:
return -1;
}
timeunit = TpS[hdr.timeunit];
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC; /* XXX */
break;
}
break;
* isn't stored in the capture file.
*/
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC; /* XXX */
+
return 1;
}
wth->subtype_read = pppdump_read;
wth->subtype_seek_read = pppdump_seek_read;
wth->subtype_close = pppdump_close;
+ wth->tsprecision = WTAP_FILE_TSPREC_DSEC;
state->seek_state = g_malloc(sizeof(pppdump_t));
wth->subtype_read = radcom_read;
wth->subtype_seek_read = radcom_seek_read;
wth->snapshot_length = 0; /* not available in header, only in frame */
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
tm.tm_year = pletohs(&start_date.year)-1900;
tm.tm_mon = start_date.month-1;
wth->subtype_seek_read = snoop_seek_read;
wth->file_encap = file_encap;
wth->snapshot_length = 0; /* not available in header */
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
return 1;
}
wth->snapshot_length = 0; /* not known */
wth->subtype_read = toshiba_read;
wth->subtype_seek_read = toshiba_seek_read;
+ wth->tsprecision = WTAP_FILE_TSPREC_CSEC;
return 1;
}
wth->subtype_read = visual_read;
wth->subtype_seek_read = visual_seek_read;
wth->subtype_close = visual_close;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
/* Add Visual-specific information to the wiretap struct for later use. */
visual = g_malloc(sizeof(struct visual_read_info));
wth->snapshot_length = 0; /* not known */
wth->subtype_read = vms_read;
wth->subtype_seek_read = vms_seek_read;
+ wth->tsprecision = WTAP_FILE_TSPREC_CSEC;
return 1;
}
per-file encapsulation
types */
int tsprecision; /* timestamp precision of the lower 32bits
- * 6 is microseconds, 9 is nanoseconds */
+ * e.g. WTAP_FILE_TSPREC_USEC */
};
struct wtap_dumper;
/* last WTAP_FILE_ value + 1 */
#define WTAP_NUM_FILE_TYPES 41
-/* timestamp accuracy (currently only these values are supported) */
+/* timestamp precision (currently only these values are supported) */
+#define WTAP_FILE_TSPREC_SEC 0
+#define WTAP_FILE_TSPREC_DSEC 1
+#define WTAP_FILE_TSPREC_CSEC 2
+#define WTAP_FILE_TSPREC_MSEC 3
#define WTAP_FILE_TSPREC_USEC 6
#define WTAP_FILE_TSPREC_NSEC 9