Blame SOURCES/wireshark-1.10.3-nanosecond-timestamps.patch

affdba
diff --git a/acinclude.m4 b/acinclude.m4
affdba
index f962022..719bdbe 100644
affdba
--- a/acinclude.m4
affdba
+++ b/acinclude.m4
affdba
@@ -615,7 +615,7 @@ install a newer version of the header file.])
affdba
 	  AC_CHECK_FUNCS(pcap_datalink_val_to_description)
affdba
 	  AC_CHECK_FUNCS(pcap_list_datalinks pcap_set_datalink pcap_lib_version)
affdba
 	  AC_CHECK_FUNCS(pcap_get_selectable_fd pcap_free_datalinks)
affdba
-	  AC_CHECK_FUNCS(pcap_create bpf_image)
affdba
+	  AC_CHECK_FUNCS(pcap_create bpf_image pcap_set_tstamp_precision)
affdba
 	fi
affdba
 	LIBS="$ac_save_LIBS"
affdba
 ])
affdba
diff --git a/cmake/modules/FindPCAP.cmake b/cmake/modules/FindPCAP.cmake
affdba
index 1d3c1b6..bde07d7 100644
affdba
--- a/cmake/modules/FindPCAP.cmake
affdba
+++ b/cmake/modules/FindPCAP.cmake
affdba
@@ -121,6 +121,7 @@ CHECK_FUNCTION_EXISTS("pcap_get_selectable_fd" HAVE_PCAP_GET_SELECTABLE_FD)
affdba
 CHECK_FUNCTION_EXISTS("pcap_lib_version" HAVE_PCAP_LIB_VERSION)
affdba
 CHECK_FUNCTION_EXISTS("pcap_list_datalinks" HAVE_PCAP_LIST_DATALINKS)
affdba
 CHECK_FUNCTION_EXISTS("pcap_set_datalink" HAVE_PCAP_SET_DATALINK)
affdba
+CHECK_FUNCTION_EXISTS("pcap_set_tstamp_precision" HAVE_PCAP_SET_TSTAMP_PRECISION)
affdba
 # Remote pcap checks
affdba
 CHECK_FUNCTION_EXISTS("pcap_open" H_PCAP_OPEN)
affdba
 CHECK_FUNCTION_EXISTS("pcap_findalldevs_ex" H_FINDALLDEVS_EX)
affdba
diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in
affdba
index 2ef36d1..fee55c5 100644
affdba
--- a/cmakeconfig.h.in
affdba
+++ b/cmakeconfig.h.in
affdba
@@ -252,6 +252,9 @@
affdba
 #cmakedefine HAVE_PCAP_REMOTE 1
affdba
 #cmakedefine HAVE_REMOTE 1
affdba
 
affdba
+/* Define to 1 if you have the `pcap_set_tstamp_precision' function. */
affdba
+#cmakedefine HAVE_PCAP_SET_TSTAMP_PRECISION 1
affdba
+
affdba
 /* Define to 1 if you have the <portaudio.h> header file. */
affdba
 #cmakedefine HAVE_PORTAUDIO_H 1
affdba
 
affdba
diff --git a/dumpcap.c b/dumpcap.c
affdba
index adba93d..bae3fbf 100644
affdba
--- a/dumpcap.c
affdba
+++ b/dumpcap.c
affdba
@@ -641,7 +641,12 @@ relinquish_all_capabilities(void)
affdba
 #endif
affdba
 
affdba
 static pcap_t *
affdba
-open_capture_device(interface_options *interface_opts,
affdba
+open_capture_device(capture_options *capture_opts
affdba
+#ifndef HAVE_PCAP_SET_TSTAMP_PRECISION
affdba
+                    _U_
affdba
+#endif
affdba
+                    ,
affdba
+                    interface_options *interface_opts,
affdba
                     char (*open_err_str)[PCAP_ERRBUF_SIZE])
affdba
 {
affdba
     pcap_t *pcap_h;
affdba
@@ -714,6 +719,31 @@ open_capture_device(interface_options *interface_opts,
affdba
             pcap_set_promisc(pcap_h, interface_opts->promisc_mode);
affdba
             pcap_set_timeout(pcap_h, CAP_READ_TIMEOUT);
affdba
 
affdba
+#ifdef HAVE_PCAP_SET_TSTAMP_PRECISION
affdba
+            /*
affdba
+             * If we're writing pcap-ng files, try to enable
affdba
+             * nanosecond-resolution capture; any code that
affdba
+             * can read pcap-ng files must be able to handle
affdba
+             * nanosecond-resolution time stamps.
affdba
+             *
affdba
+             * If we're writing pcap files, don't try to enable
affdba
+             * nanosecond-resolution capture, as not all code
affdba
+             * that reads pcap files recognizes the nanosecond-
affdba
+             * resolution pcap file magic number.
affdba
+             */
affdba
+            if (capture_opts->use_pcapng) {
affdba
+                /*
affdba
+                 * The only errors this is documenting as returning
affdba
+                 * are PCAP_ERROR_TSTAMP_PRECISION_NOTSUP, which jus
affdba
+                 * means we can't do nanosecond precision on this adapter,
affdba
+                 * in which case we just live with whatever resolution
affdba
+                 * we get by default, and PCAP_ERROR_ACTIVATED, which
affdba
+                 * can't happen as we haven't activated the pcap_t yet.
affdba
+                 */
affdba
+                pcap_set_tstamp_precision(pcap_h, PCAP_TSTAMP_PRECISION_NANO);
affdba
+            }
affdba
+#endif
affdba
+
affdba
             g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG,
affdba
                   "buffersize %d.", interface_opts->buffer_size);
affdba
             if (interface_opts->buffer_size != 0) {
affdba
@@ -913,7 +943,7 @@ show_filter_code(capture_options *capture_opts)
affdba
 
affdba
     for (j = 0; j < capture_opts->ifaces->len; j++) {
affdba
         interface_opts = g_array_index(capture_opts->ifaces, interface_options, j);
affdba
-        pcap_h = open_capture_device(&interface_opts, &open_err_str);
affdba
+        pcap_h = open_capture_device(capture_opts, &interface_opts, &open_err_str);
affdba
         if (pcap_h == NULL) {
affdba
             /* Open failed; get messages */
affdba
             get_capture_device_open_failure_messages(open_err_str,
affdba
@@ -2680,10 +2710,16 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld,
affdba
         g_array_append_val(ld->pcaps, pcap_opts);
affdba
 
affdba
         g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "capture_loop_open_input : %s", interface_opts.name);
affdba
-        pcap_opts->pcap_h = open_capture_device(&interface_opts, &open_err_str);
affdba
+        pcap_opts->pcap_h = open_capture_device(capture_opts, &interface_opts, &open_err_str);
affdba
 
affdba
         if (pcap_opts->pcap_h != NULL) {
affdba
             /* we've opened "iface" as a network device */
affdba
+
affdba
+#ifdef HAVE_PCAP_SET_TSTAMP_PRECISION
affdba
+        /* Find out if we're getting nanosecond-precision time stamps */
affdba
+        pcap_opts->ts_nsec = pcap_get_tstamp_precision(pcap_opts->pcap_h) == PCAP_TSTAMP_PRECISION_NANO;
affdba
+#endif
affdba
+
affdba
 #ifdef _WIN32
affdba
             /* try to set the capture buffer size */
affdba
             if (interface_opts.buffer_size > 1 &&
affdba
diff --git a/editcap.c b/editcap.c
affdba
index 9ba8245..8caa1bf 100644
affdba
--- a/editcap.c
affdba
+++ b/editcap.c
affdba
@@ -125,7 +125,6 @@ fd_hash_t fd_hash[MAX_DUP_DEPTH];
affdba
 int dup_window = DEFAULT_DUP_DEPTH;
affdba
 int cur_dup_entry = 0;
affdba
 
affdba
-#define ONE_MILLION 1000000
affdba
 #define ONE_BILLION 1000000000
affdba
 
affdba
 /* Weights of different errors we can introduce */
affdba
@@ -143,7 +142,7 @@ int cur_dup_entry = 0;
affdba
 
affdba
 
affdba
 struct time_adjustment {
affdba
-  struct timeval tv;
affdba
+  nstime_t tv;
affdba
   int is_negative;
affdba
 };
affdba
 
affdba
@@ -368,18 +367,18 @@ set_time_adjustment(char *optarg_str_p)
affdba
           exit(1);
affdba
       }
affdba
   }
affdba
-  time_adj.tv.tv_sec = val;
affdba
+  time_adj.tv.secs = val;
affdba
 
affdba
   /* now collect the partial seconds, if any */
affdba
   if (*frac != '\0') {             /* chars left, so get fractional part */
affdba
     val = strtol(&(frac[1]), &end, 10);
affdba
-    /* if more than 6 fractional digits truncate to 6 */
affdba
-    if((end - &(frac[1])) > 6) {
affdba
-        frac[7] = 't'; /* 't' for truncate */
affdba
+    /* if more than 9 fractional digits truncate to 9 */
affdba
+    if((end - &(frac[1])) > 9) {
affdba
+        frac[10] = 't'; /* 't' for truncate */
affdba
         val = strtol(&(frac[1]), &end, 10);
affdba
     }
affdba
     if (*frac != '.' || end == NULL || end == frac
affdba
-        || val < 0 || val > ONE_MILLION || val == LONG_MIN || val == LONG_MAX) {
affdba
+        || val < 0 || val > ONE_BILLION || val == LONG_MIN || val == LONG_MAX) {
affdba
       fprintf(stderr, "editcap: \"%s\" isn't a valid time adjustment\n",
affdba
               optarg_str_p);
affdba
       exit(1);
affdba
@@ -390,15 +389,15 @@ set_time_adjustment(char *optarg_str_p)
affdba
   }
affdba
 
affdba
   /* adjust fractional portion from fractional to numerator
affdba
-   * e.g., in "1.5" from 5 to 500000 since .5*10^6 = 500000 */
affdba
+   * e.g., in "1.5" from 5 to 500000000 since .5*10^9 = 500000000 */
affdba
   if (frac && end) {            /* both are valid */
affdba
     frac_digits = end - frac - 1;   /* fractional digit count (remember '.') */
affdba
-    while(frac_digits < 6) {    /* this is frac of 10^6 */
affdba
+    while(frac_digits < 9) {    /* this is frac of 10^9 */
affdba
       val *= 10;
affdba
       frac_digits++;
affdba
     }
affdba
   }
affdba
-  time_adj.tv.tv_usec = (int)val;
affdba
+  time_adj.tv.nsecs = (int) val;
affdba
 }
affdba
 
affdba
 static void
affdba
@@ -443,18 +442,18 @@ set_strict_time_adj(char *optarg_str_p)
affdba
           exit(1);
affdba
       }
affdba
   }
affdba
-  strict_time_adj.tv.tv_sec = val;
affdba
+  strict_time_adj.tv.secs = val;
affdba
 
affdba
   /* now collect the partial seconds, if any */
affdba
   if (*frac != '\0') {             /* chars left, so get fractional part */
affdba
     val = strtol(&(frac[1]), &end, 10);
affdba
-    /* if more than 6 fractional digits truncate to 6 */
affdba
-    if((end - &(frac[1])) > 6) {
affdba
-        frac[7] = 't'; /* 't' for truncate */
affdba
+    /* if more than 9 fractional digits truncate to 9 */
affdba
+    if((end - &(frac[1])) > 9) {
affdba
+        frac[10] = 't'; /* 't' for truncate */
affdba
         val = strtol(&(frac[1]), &end, 10);
affdba
     }
affdba
     if (*frac != '.' || end == NULL || end == frac
affdba
-        || val < 0 || val > ONE_MILLION || val == LONG_MIN || val == LONG_MAX) {
affdba
+        || val < 0 || val > ONE_BILLION || val == LONG_MIN || val == LONG_MAX) {
affdba
       fprintf(stderr, "editcap: \"%s\" isn't a valid time adjustment\n",
affdba
               optarg_str_p);
affdba
       exit(1);
affdba
@@ -465,15 +464,15 @@ set_strict_time_adj(char *optarg_str_p)
affdba
   }
affdba
 
affdba
   /* adjust fractional portion from fractional to numerator
affdba
-   * e.g., in "1.5" from 5 to 500000 since .5*10^6 = 500000 */
affdba
+   * e.g., in "1.5" from 5 to 500000000 since .5*10^9 = 500000000 */
affdba
   if (frac && end) {            /* both are valid */
affdba
     frac_digits = end - frac - 1;   /* fractional digit count (remember '.') */
affdba
-    while(frac_digits < 6) {    /* this is frac of 10^6 */
affdba
+    while(frac_digits < 9) {    /* this is frac of 10^9 */
affdba
       val *= 10;
affdba
       frac_digits++;
affdba
     }
affdba
   }
affdba
-  strict_time_adj.tv.tv_usec = (int)val;
affdba
+  strict_time_adj.tv.nsecs = (int) val;
affdba
 }
affdba
 
affdba
 static void
affdba
@@ -1319,14 +1318,14 @@ main(int argc, char *argv[])
affdba
                  */
affdba
                 /* printf("++out of order, need to adjust this packet!\n"); */
affdba
                 snap_phdr = *phdr;
affdba
-                snap_phdr.ts.secs = previous_time.secs + strict_time_adj.tv.tv_sec;
affdba
+                snap_phdr.ts.secs = previous_time.secs + strict_time_adj.tv.secs;
affdba
                 snap_phdr.ts.nsecs = previous_time.nsecs;
affdba
-                if (snap_phdr.ts.nsecs + strict_time_adj.tv.tv_usec * 1000 > ONE_MILLION * 1000) {
affdba
+                if (snap_phdr.ts.nsecs + strict_time_adj.tv.nsecs > ONE_BILLION) {
affdba
                   /* carry */
affdba
                   snap_phdr.ts.secs++;
affdba
-                  snap_phdr.ts.nsecs += (strict_time_adj.tv.tv_usec - ONE_MILLION) * 1000;
affdba
+                  snap_phdr.ts.nsecs += strict_time_adj.tv.nsecs - ONE_BILLION;
affdba
                 } else {
affdba
-                  snap_phdr.ts.nsecs += strict_time_adj.tv.tv_usec * 1000;
affdba
+                  snap_phdr.ts.nsecs += strict_time_adj.tv.nsecs;
affdba
                 }
affdba
                 phdr = &snap_phdr;
affdba
               }
affdba
@@ -1337,14 +1336,14 @@ main(int argc, char *argv[])
affdba
                * packet's timestamp plus delta.
affdba
                */
affdba
               snap_phdr = *phdr;
affdba
-              snap_phdr.ts.secs = previous_time.secs + strict_time_adj.tv.tv_sec;
affdba
+              snap_phdr.ts.secs = previous_time.secs + strict_time_adj.tv.secs;
affdba
               snap_phdr.ts.nsecs = previous_time.nsecs;
affdba
-              if (snap_phdr.ts.nsecs + strict_time_adj.tv.tv_usec * 1000 > ONE_MILLION * 1000) {
affdba
+              if (snap_phdr.ts.nsecs + strict_time_adj.tv.nsecs > ONE_BILLION) {
affdba
                 /* carry */
affdba
                 snap_phdr.ts.secs++;
affdba
-                snap_phdr.ts.nsecs += (strict_time_adj.tv.tv_usec - ONE_MILLION) * 1000;
affdba
+                snap_phdr.ts.nsecs += strict_time_adj.tv.nsecs - ONE_BILLION;
affdba
               } else {
affdba
-                snap_phdr.ts.nsecs += strict_time_adj.tv.tv_usec * 1000;
affdba
+                snap_phdr.ts.nsecs += strict_time_adj.tv.nsecs;
affdba
               }
affdba
               phdr = &snap_phdr;
affdba
             }
affdba
@@ -1355,32 +1354,32 @@ main(int argc, char *argv[])
affdba
 
affdba
         /* assume that if the frame's tv_sec is 0, then
affdba
          * the timestamp isn't supported */
affdba
-        if (phdr->ts.secs > 0 && time_adj.tv.tv_sec != 0) {
affdba
+        if (phdr->ts.secs > 0 && time_adj.tv.secs != 0) {
affdba
           snap_phdr = *phdr;
affdba
           if (time_adj.is_negative)
affdba
-            snap_phdr.ts.secs -= time_adj.tv.tv_sec;
affdba
+            snap_phdr.ts.secs -= time_adj.tv.secs;
affdba
           else
affdba
-            snap_phdr.ts.secs += time_adj.tv.tv_sec;
affdba
+            snap_phdr.ts.secs += time_adj.tv.secs;
affdba
           phdr = &snap_phdr;
affdba
         }
affdba
 
affdba
         /* assume that if the frame's tv_sec is 0, then
affdba
          * the timestamp isn't supported */
affdba
-        if (phdr->ts.secs > 0 && time_adj.tv.tv_usec != 0) {
affdba
+        if (phdr->ts.secs > 0 && time_adj.tv.nsecs != 0) {
affdba
           snap_phdr = *phdr;
affdba
           if (time_adj.is_negative) { /* subtract */
affdba
-            if (snap_phdr.ts.nsecs/1000 < time_adj.tv.tv_usec) { /* borrow */
affdba
+            if (snap_phdr.ts.nsecs < time_adj.tv.nsecs) { /* borrow */
affdba
               snap_phdr.ts.secs--;
affdba
-              snap_phdr.ts.nsecs += ONE_MILLION * 1000;
affdba
+              snap_phdr.ts.nsecs += ONE_BILLION;
affdba
             }
affdba
-            snap_phdr.ts.nsecs -= time_adj.tv.tv_usec * 1000;
affdba
+            snap_phdr.ts.nsecs -= time_adj.tv.nsecs;
affdba
           } else {                  /* add */
affdba
-            if (snap_phdr.ts.nsecs + time_adj.tv.tv_usec * 1000 > ONE_MILLION * 1000) {
affdba
+            if (snap_phdr.ts.nsecs + time_adj.tv.nsecs > ONE_BILLION) {
affdba
               /* carry */
affdba
               snap_phdr.ts.secs++;
affdba
-              snap_phdr.ts.nsecs += (time_adj.tv.tv_usec - ONE_MILLION) * 1000;
affdba
+              snap_phdr.ts.nsecs += time_adj.tv.nsecs - ONE_BILLION;
affdba
             } else {
affdba
-              snap_phdr.ts.nsecs += time_adj.tv.tv_usec * 1000;
affdba
+              snap_phdr.ts.nsecs += time_adj.tv.nsecs;
affdba
             }
affdba
           }
affdba
           phdr = &snap_phdr;
affdba
diff --git a/epan/column-utils.c b/epan/column-utils.c
affdba
index 6ed9f85..8e89409 100644
affdba
--- a/epan/column-utils.c
affdba
+++ b/epan/column-utils.c
affdba
@@ -675,6 +675,7 @@ set_abs_date_time(const frame_data *fd, gchar *buf, gboolean local)
affdba
 {
affdba
   struct tm *tmp;
affdba
   time_t then;
affdba
+  int tsprecision;
affdba
 
affdba
   if (fd->flags.has_ts) {
affdba
     then = fd->abs_ts.secs;
affdba
@@ -685,9 +686,33 @@ set_abs_date_time(const frame_data *fd, gchar *buf, gboolean local)
affdba
   } else
affdba
     tmp = NULL;
affdba
   if (tmp != NULL) {
affdba
-      switch(timestamp_get_precision()) {
affdba
-      case TS_PREC_FIXED_SEC:
affdba
-      case TS_PREC_AUTO_SEC:
affdba
+      switch (timestamp_get_precision()) {
affdba
+        case TS_PREC_FIXED_SEC:
affdba
+            tsprecision = WTAP_TSPREC_SEC;
affdba
+            break;
affdba
+        case TS_PREC_FIXED_DSEC:
affdba
+            tsprecision = WTAP_TSPREC_DSEC;
affdba
+            break;
affdba
+        case TS_PREC_FIXED_CSEC:
affdba
+            tsprecision = WTAP_TSPREC_CSEC;
affdba
+            break;
affdba
+        case TS_PREC_FIXED_MSEC:
affdba
+            tsprecision = WTAP_TSPREC_MSEC;
affdba
+            break;
affdba
+        case TS_PREC_FIXED_USEC:
affdba
+            tsprecision = WTAP_TSPREC_USEC;
affdba
+            break;
affdba
+        case TS_PREC_FIXED_NSEC:
affdba
+            tsprecision = WTAP_TSPREC_NSEC;
affdba
+            break;
affdba
+        case TS_PREC_AUTO:
affdba
+            tsprecision = fd->tsprec;
affdba
+            break;
affdba
+        default:
affdba
+            g_assert_not_reached();
affdba
+      }
affdba
+      switch(tsprecision) {
affdba
+      case WTAP_TSPREC_SEC:
affdba
           g_snprintf(buf, COL_MAX_LEN,"%04d-%02d-%02d %02d:%02d:%02d",
affdba
              tmp->tm_year + 1900,
affdba
              tmp->tm_mon + 1,
affdba
@@ -696,8 +721,7 @@ set_abs_date_time(const frame_data *fd, gchar *buf, gboolean local)
affdba
              tmp->tm_min,
affdba
              tmp->tm_sec);
affdba
           break;
affdba
-      case TS_PREC_FIXED_DSEC:
affdba
-      case TS_PREC_AUTO_DSEC:
affdba
+      case WTAP_TSPREC_DSEC:
affdba
           g_snprintf(buf, COL_MAX_LEN,"%04d-%02d-%02d %02d:%02d:%02d.%01d",
affdba
              tmp->tm_year + 1900,
affdba
              tmp->tm_mon + 1,
affdba
@@ -707,8 +731,7 @@ set_abs_date_time(const frame_data *fd, gchar *buf, gboolean local)
affdba
              tmp->tm_sec,
affdba
              fd->abs_ts.nsecs / 100000000);
affdba
           break;
affdba
-      case TS_PREC_FIXED_CSEC:
affdba
-      case TS_PREC_AUTO_CSEC:
affdba
+      case WTAP_TSPREC_CSEC:
affdba
           g_snprintf(buf, COL_MAX_LEN,"%04d-%02d-%02d %02d:%02d:%02d.%02d",
affdba
              tmp->tm_year + 1900,
affdba
              tmp->tm_mon + 1,
affdba
@@ -718,8 +741,7 @@ set_abs_date_time(const frame_data *fd, gchar *buf, gboolean local)
affdba
              tmp->tm_sec,
affdba
              fd->abs_ts.nsecs / 10000000);
affdba
           break;
affdba
-      case TS_PREC_FIXED_MSEC:
affdba
-      case TS_PREC_AUTO_MSEC:
affdba
+      case WTAP_TSPREC_MSEC:
affdba
           g_snprintf(buf, COL_MAX_LEN, "%04d-%02d-%02d %02d:%02d:%02d.%03d",
affdba
              tmp->tm_year + 1900,
affdba
              tmp->tm_mon + 1,
affdba
@@ -729,8 +751,7 @@ set_abs_date_time(const frame_data *fd, gchar *buf, gboolean local)
affdba
              tmp->tm_sec,
affdba
              fd->abs_ts.nsecs / 1000000);
affdba
           break;
affdba
-      case TS_PREC_FIXED_USEC:
affdba
-      case TS_PREC_AUTO_USEC:
affdba
+      case WTAP_TSPREC_USEC:
affdba
           g_snprintf(buf, COL_MAX_LEN, "%04d-%02d-%02d %02d:%02d:%02d.%06d",
affdba
              tmp->tm_year + 1900,
affdba
              tmp->tm_mon + 1,
affdba
@@ -740,8 +761,7 @@ set_abs_date_time(const frame_data *fd, gchar *buf, gboolean local)
affdba
              tmp->tm_sec,
affdba
              fd->abs_ts.nsecs / 1000);
affdba
           break;
affdba
-      case TS_PREC_FIXED_NSEC:
affdba
-      case TS_PREC_AUTO_NSEC:
affdba
+      case WTAP_TSPREC_NSEC:
affdba
           g_snprintf(buf, COL_MAX_LEN, "%04d-%02d-%02d %02d:%02d:%02d.%09d",
affdba
              tmp->tm_year + 1900,
affdba
              tmp->tm_mon + 1,
affdba
@@ -780,36 +800,57 @@ col_set_utc_date_time(const frame_data *fd, column_info *cinfo, const int col)
affdba
 }
affdba
 
affdba
 static void
affdba
-set_time_seconds(const nstime_t *ts, gchar *buf)
affdba
+set_time_seconds(const frame_data *fd, const nstime_t *ts, gchar *buf)
affdba
 {
affdba
-  switch(timestamp_get_precision()) {
affdba
-      case TS_PREC_FIXED_SEC:
affdba
-      case TS_PREC_AUTO_SEC:
affdba
+  int tsprecision;
affdba
+
affdba
+  switch (timestamp_get_precision()) {
affdba
+  case TS_PREC_FIXED_SEC:
affdba
+      tsprecision = WTAP_TSPREC_SEC;
affdba
+      break;
affdba
+  case TS_PREC_FIXED_DSEC:
affdba
+      tsprecision = WTAP_TSPREC_DSEC;
affdba
+      break;
affdba
+  case TS_PREC_FIXED_CSEC:
affdba
+      tsprecision = WTAP_TSPREC_CSEC;
affdba
+      break;
affdba
+  case TS_PREC_FIXED_MSEC:
affdba
+      tsprecision = WTAP_TSPREC_MSEC;
affdba
+      break;
affdba
+  case TS_PREC_FIXED_USEC:
affdba
+      tsprecision = WTAP_TSPREC_USEC;
affdba
+      break;
affdba
+  case TS_PREC_FIXED_NSEC:
affdba
+      tsprecision = WTAP_TSPREC_NSEC;
affdba
+      break;
affdba
+  case TS_PREC_AUTO:
affdba
+      tsprecision = fd->tsprec;
affdba
+      break;
affdba
+  default:
affdba
+      g_assert_not_reached();
affdba
+  }
affdba
+  switch(tsprecision) {
affdba
+      case WTAP_TSPREC_SEC:
affdba
           display_signed_time(buf, COL_MAX_LEN,
affdba
             (gint32) ts->secs, ts->nsecs / 1000000000, TO_STR_TIME_RES_T_SECS);
affdba
           break;
affdba
-      case TS_PREC_FIXED_DSEC:
affdba
-      case TS_PREC_AUTO_DSEC:
affdba
+      case WTAP_TSPREC_DSEC:
affdba
           display_signed_time(buf, COL_MAX_LEN,
affdba
             (gint32) ts->secs, ts->nsecs / 100000000, TO_STR_TIME_RES_T_DSECS);
affdba
           break;
affdba
-      case TS_PREC_FIXED_CSEC:
affdba
-      case TS_PREC_AUTO_CSEC:
affdba
+      case WTAP_TSPREC_CSEC:
affdba
           display_signed_time(buf, COL_MAX_LEN,
affdba
             (gint32) ts->secs, ts->nsecs / 10000000, TO_STR_TIME_RES_T_CSECS);
affdba
           break;
affdba
-      case TS_PREC_FIXED_MSEC:
affdba
-      case TS_PREC_AUTO_MSEC:
affdba
+      case WTAP_TSPREC_MSEC:
affdba
           display_signed_time(buf, COL_MAX_LEN,
affdba
             (gint32) ts->secs, ts->nsecs / 1000000, TO_STR_TIME_RES_T_MSECS);
affdba
           break;
affdba
-      case TS_PREC_FIXED_USEC:
affdba
-      case TS_PREC_AUTO_USEC:
affdba
+      case WTAP_TSPREC_USEC:
affdba
           display_signed_time(buf, COL_MAX_LEN,
affdba
             (gint32) ts->secs, ts->nsecs / 1000, TO_STR_TIME_RES_T_USECS);
affdba
           break;
affdba
-      case TS_PREC_FIXED_NSEC:
affdba
-      case TS_PREC_AUTO_NSEC:
affdba
+      case WTAP_TSPREC_NSEC:
affdba
           display_signed_time(buf, COL_MAX_LEN,
affdba
             (gint32) ts->secs, ts->nsecs, TO_STR_TIME_RES_T_NSECS);
affdba
           break;
affdba
@@ -819,11 +860,12 @@ set_time_seconds(const nstime_t *ts, gchar *buf)
affdba
 }
affdba
 
affdba
 static void
affdba
-set_time_hour_min_sec(const nstime_t *ts, gchar *buf)
affdba
+set_time_hour_min_sec(const frame_data *fd, const nstime_t *ts, gchar *buf)
affdba
 {
affdba
   time_t secs = ts->secs;
affdba
   long nsecs = (long) ts->nsecs;
affdba
   gboolean negative = FALSE;
affdba
+  int tsprecision;
affdba
 
affdba
   if (secs < 0) {
affdba
     secs = -secs;
affdba
@@ -834,9 +876,33 @@ set_time_hour_min_sec(const nstime_t *ts, gchar *buf)
affdba
     negative = TRUE;
affdba
   }
affdba
 
affdba
-  switch(timestamp_get_precision()) {
affdba
+  switch (timestamp_get_precision()) {
affdba
   case TS_PREC_FIXED_SEC:
affdba
-  case TS_PREC_AUTO_SEC:
affdba
+      tsprecision = WTAP_TSPREC_SEC;
affdba
+      break;
affdba
+  case TS_PREC_FIXED_DSEC:
affdba
+      tsprecision = WTAP_TSPREC_DSEC;
affdba
+      break;
affdba
+  case TS_PREC_FIXED_CSEC:
affdba
+      tsprecision = WTAP_TSPREC_CSEC;
affdba
+      break;
affdba
+  case TS_PREC_FIXED_MSEC:
affdba
+      tsprecision = WTAP_TSPREC_MSEC;
affdba
+      break;
affdba
+  case TS_PREC_FIXED_USEC:
affdba
+      tsprecision = WTAP_TSPREC_USEC;
affdba
+      break;
affdba
+  case TS_PREC_FIXED_NSEC:
affdba
+      tsprecision = WTAP_TSPREC_NSEC;
affdba
+      break;
affdba
+  case TS_PREC_AUTO:
affdba
+      tsprecision = fd->tsprec;
affdba
+      break;
affdba
+  default:
affdba
+      g_assert_not_reached();
affdba
+  }
affdba
+  switch(tsprecision) {
affdba
+  case WTAP_TSPREC_SEC:
affdba
     if (secs >= (60*60)) {
affdba
       g_snprintf(buf, COL_MAX_LEN, "%s%dh %2dm %2ds",
affdba
 		 negative ? "- " : "",
affdba
@@ -854,8 +920,7 @@ set_time_hour_min_sec(const nstime_t *ts, gchar *buf)
affdba
 		 (gint32) secs);
affdba
     }
affdba
     break;
affdba
-  case TS_PREC_FIXED_DSEC:
affdba
-  case TS_PREC_AUTO_DSEC:
affdba
+  case WTAP_TSPREC_DSEC:
affdba
     if (secs >= (60*60)) {
affdba
       g_snprintf(buf, COL_MAX_LEN, "%s%dh %2dm %2d.%01lds",
affdba
 		 negative ? "- " : "",
affdba
@@ -876,8 +941,7 @@ set_time_hour_min_sec(const nstime_t *ts, gchar *buf)
affdba
 		 nsecs / 100000000);
affdba
     }
affdba
     break;
affdba
-  case TS_PREC_FIXED_CSEC:
affdba
-  case TS_PREC_AUTO_CSEC:
affdba
+  case WTAP_TSPREC_CSEC:
affdba
     if (secs >= (60*60)) {
affdba
       g_snprintf(buf, COL_MAX_LEN, "%s%dh %2dm %2d.%02lds",
affdba
 		 negative ? "- " : "",
affdba
@@ -898,8 +962,7 @@ set_time_hour_min_sec(const nstime_t *ts, gchar *buf)
affdba
 		 nsecs / 10000000);
affdba
     }
affdba
     break;
affdba
-  case TS_PREC_FIXED_MSEC:
affdba
-  case TS_PREC_AUTO_MSEC:
affdba
+  case WTAP_TSPREC_MSEC:
affdba
     if (secs >= (60*60)) {
affdba
       g_snprintf(buf, COL_MAX_LEN, "%s%dh %2dm %2d.%03lds",
affdba
 		 negative ? "- " : "",
affdba
@@ -920,8 +983,7 @@ set_time_hour_min_sec(const nstime_t *ts, gchar *buf)
affdba
 		 nsecs / 1000000);
affdba
     }
affdba
     break;
affdba
-  case TS_PREC_FIXED_USEC:
affdba
-  case TS_PREC_AUTO_USEC:
affdba
+  case WTAP_TSPREC_USEC:
affdba
     if (secs >= (60*60)) {
affdba
       g_snprintf(buf, COL_MAX_LEN, "%s%dh %2dm %2d.%06lds",
affdba
 		 negative ? "- " : "",
affdba
@@ -942,8 +1004,7 @@ set_time_hour_min_sec(const nstime_t *ts, gchar *buf)
affdba
 		 nsecs / 1000);
affdba
     }
affdba
     break;
affdba
-  case TS_PREC_FIXED_NSEC:
affdba
-  case TS_PREC_AUTO_NSEC:
affdba
+  case WTAP_TSPREC_NSEC:
affdba
     if (secs >= (60*60)) {
affdba
       g_snprintf(buf, COL_MAX_LEN, "%s%dh %2dm %2d.%09lds",
affdba
 		 negative ? "- " : "",
affdba
@@ -978,14 +1039,14 @@ col_set_rel_time(const frame_data *fd, column_info *cinfo, const int col)
affdba
   }
affdba
   switch (timestamp_get_seconds_type()) {
affdba
   case TS_SECONDS_DEFAULT:
affdba
-    set_time_seconds(&fd->rel_ts, cinfo->col_buf[col]);
affdba
+    set_time_seconds(fd, &fd->rel_ts, cinfo->col_buf[col]);
affdba
     cinfo->col_expr.col_expr[col] = "frame.time_relative";
affdba
     g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
affdba
     break;
affdba
   case TS_SECONDS_HOUR_MIN_SEC:
affdba
-    set_time_hour_min_sec(&fd->rel_ts, cinfo->col_buf[col]);
affdba
+    set_time_hour_min_sec(fd, &fd->rel_ts, cinfo->col_buf[col]);
affdba
     cinfo->col_expr.col_expr[col] = "frame.time_relative";
affdba
-    set_time_seconds(&fd->rel_ts, cinfo->col_expr.col_expr_val[col]);
affdba
+    set_time_seconds(fd, &fd->rel_ts, cinfo->col_expr.col_expr_val[col]);
affdba
     break;
affdba
   default:
affdba
     g_assert_not_reached();
affdba
@@ -1002,14 +1063,14 @@ col_set_delta_time(const frame_data *fd, column_info *cinfo, const int col)
affdba
 
affdba
   switch (timestamp_get_seconds_type()) {
affdba
   case TS_SECONDS_DEFAULT:
affdba
-    set_time_seconds(&del_cap_ts, cinfo->col_buf[col]);
affdba
+    set_time_seconds(fd, &del_cap_ts, cinfo->col_buf[col]);
affdba
     cinfo->col_expr.col_expr[col] = "frame.time_delta";
affdba
     g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
affdba
     break;
affdba
   case TS_SECONDS_HOUR_MIN_SEC:
affdba
-    set_time_hour_min_sec(&del_cap_ts, cinfo->col_buf[col]);
affdba
+    set_time_hour_min_sec(fd, &del_cap_ts, cinfo->col_buf[col]);
affdba
     cinfo->col_expr.col_expr[col] = "frame.time_delta";
affdba
-    set_time_seconds(&del_cap_ts, cinfo->col_expr.col_expr_val[col]);
affdba
+    set_time_seconds(fd, &del_cap_ts, cinfo->col_expr.col_expr_val[col]);
affdba
     break;
affdba
   default:
affdba
     g_assert_not_reached();
affdba
@@ -1032,14 +1093,14 @@ col_set_delta_time_dis(const frame_data *fd, column_info *cinfo, const int col)
affdba
 
affdba
   switch (timestamp_get_seconds_type()) {
affdba
   case TS_SECONDS_DEFAULT:
affdba
-    set_time_seconds(&del_dis_ts, cinfo->col_buf[col]);
affdba
+    set_time_seconds(fd, &del_dis_ts, cinfo->col_buf[col]);
affdba
     cinfo->col_expr.col_expr[col] = "frame.time_delta_displayed";
affdba
     g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
affdba
     break;
affdba
   case TS_SECONDS_HOUR_MIN_SEC:
affdba
-    set_time_hour_min_sec(&del_dis_ts, cinfo->col_buf[col]);
affdba
+    set_time_hour_min_sec(fd, &del_dis_ts, cinfo->col_buf[col]);
affdba
     cinfo->col_expr.col_expr[col] = "frame.time_delta_displayed";
affdba
-    set_time_seconds(&del_dis_ts, cinfo->col_expr.col_expr_val[col]);
affdba
+    set_time_seconds(fd, &del_dis_ts, cinfo->col_expr.col_expr_val[col]);
affdba
     break;
affdba
   default:
affdba
     g_assert_not_reached();
affdba
@@ -1053,6 +1114,7 @@ set_abs_time(const frame_data *fd, gchar *buf, gboolean local)
affdba
 {
affdba
   struct tm *tmp;
affdba
   time_t then;
affdba
+  int tsprecision;
affdba
 
affdba
   if (fd->flags.has_ts) {
affdba
     then = fd->abs_ts.secs;
affdba
@@ -1063,48 +1125,67 @@ set_abs_time(const frame_data *fd, gchar *buf, gboolean local)
affdba
   } else
affdba
     tmp = NULL;
affdba
   if (tmp != NULL) {
affdba
-      switch(timestamp_get_precision()) {
affdba
+      switch (timestamp_get_precision()) {
affdba
       case TS_PREC_FIXED_SEC:
affdba
-      case TS_PREC_AUTO_SEC:
affdba
+          tsprecision = WTAP_TSPREC_SEC;
affdba
+          break;
affdba
+      case TS_PREC_FIXED_DSEC:
affdba
+          tsprecision = WTAP_TSPREC_DSEC;
affdba
+          break;
affdba
+      case TS_PREC_FIXED_CSEC:
affdba
+          tsprecision = WTAP_TSPREC_CSEC;
affdba
+          break;
affdba
+      case TS_PREC_FIXED_MSEC:
affdba
+          tsprecision = WTAP_TSPREC_MSEC;
affdba
+          break;
affdba
+      case TS_PREC_FIXED_USEC:
affdba
+          tsprecision = WTAP_TSPREC_USEC;
affdba
+          break;
affdba
+      case TS_PREC_FIXED_NSEC:
affdba
+          tsprecision = WTAP_TSPREC_NSEC;
affdba
+          break;
affdba
+      case TS_PREC_AUTO:
affdba
+          tsprecision = fd->tsprec;
affdba
+          break;
affdba
+      default:
affdba
+          g_assert_not_reached();
affdba
+      }
affdba
+      switch(tsprecision) {
affdba
+      case WTAP_TSPREC_SEC:
affdba
           g_snprintf(buf, COL_MAX_LEN,"%02d:%02d:%02d",
affdba
              tmp->tm_hour,
affdba
              tmp->tm_min,
affdba
              tmp->tm_sec);
affdba
           break;
affdba
-      case TS_PREC_FIXED_DSEC:
affdba
-      case TS_PREC_AUTO_DSEC:
affdba
+      case WTAP_TSPREC_DSEC:
affdba
           g_snprintf(buf, COL_MAX_LEN,"%02d:%02d:%02d.%01d",
affdba
              tmp->tm_hour,
affdba
              tmp->tm_min,
affdba
              tmp->tm_sec,
affdba
              fd->abs_ts.nsecs / 100000000);
affdba
           break;
affdba
-      case TS_PREC_FIXED_CSEC:
affdba
-      case TS_PREC_AUTO_CSEC:
affdba
+      case WTAP_TSPREC_CSEC:
affdba
           g_snprintf(buf, COL_MAX_LEN,"%02d:%02d:%02d.%02d",
affdba
              tmp->tm_hour,
affdba
              tmp->tm_min,
affdba
              tmp->tm_sec,
affdba
              fd->abs_ts.nsecs / 10000000);
affdba
           break;
affdba
-      case TS_PREC_FIXED_MSEC:
affdba
-      case TS_PREC_AUTO_MSEC:
affdba
+      case WTAP_TSPREC_MSEC:
affdba
           g_snprintf(buf, COL_MAX_LEN,"%02d:%02d:%02d.%03d",
affdba
              tmp->tm_hour,
affdba
              tmp->tm_min,
affdba
              tmp->tm_sec,
affdba
              fd->abs_ts.nsecs / 1000000);
affdba
           break;
affdba
-      case TS_PREC_FIXED_USEC:
affdba
-      case TS_PREC_AUTO_USEC:
affdba
+      case WTAP_TSPREC_USEC:
affdba
           g_snprintf(buf, COL_MAX_LEN,"%02d:%02d:%02d.%06d",
affdba
              tmp->tm_hour,
affdba
              tmp->tm_min,
affdba
              tmp->tm_sec,
affdba
              fd->abs_ts.nsecs / 1000);
affdba
           break;
affdba
-      case TS_PREC_FIXED_NSEC:
affdba
-      case TS_PREC_AUTO_NSEC:
affdba
+      case WTAP_TSPREC_NSEC:
affdba
           g_snprintf(buf, COL_MAX_LEN, "%02d:%02d:%02d.%09d",
affdba
              tmp->tm_hour,
affdba
              tmp->tm_min,
affdba
@@ -1143,38 +1224,59 @@ col_set_utc_time(const frame_data *fd, column_info *cinfo, const int col)
affdba
 static gboolean
affdba
 set_epoch_time(const frame_data *fd, gchar *buf)
affdba
 {
affdba
+  int tsprecision;
affdba
+
affdba
   if (!fd->flags.has_ts) {
affdba
     buf[0] = '\0';
affdba
     return FALSE;
affdba
   }
affdba
-  switch(timestamp_get_precision()) {
affdba
-      case TS_PREC_FIXED_SEC:
affdba
-      case TS_PREC_AUTO_SEC:
affdba
+  switch (timestamp_get_precision()) {
affdba
+  case TS_PREC_FIXED_SEC:
affdba
+      tsprecision = WTAP_TSPREC_SEC;
affdba
+      break;
affdba
+  case TS_PREC_FIXED_DSEC:
affdba
+      tsprecision = WTAP_TSPREC_DSEC;
affdba
+      break;
affdba
+  case TS_PREC_FIXED_CSEC:
affdba
+      tsprecision = WTAP_TSPREC_CSEC;
affdba
+      break;
affdba
+  case TS_PREC_FIXED_MSEC:
affdba
+      tsprecision = WTAP_TSPREC_MSEC;
affdba
+      break;
affdba
+  case TS_PREC_FIXED_USEC:
affdba
+      tsprecision = WTAP_TSPREC_USEC;
affdba
+      break;
affdba
+  case TS_PREC_FIXED_NSEC:
affdba
+      tsprecision = WTAP_TSPREC_NSEC;
affdba
+      break;
affdba
+  case TS_PREC_AUTO:
affdba
+      tsprecision = fd->tsprec;
affdba
+      break;
affdba
+  default:
affdba
+      g_assert_not_reached();
affdba
+  }
affdba
+  switch(tsprecision) {
affdba
+      case WTAP_TSPREC_SEC:
affdba
           display_epoch_time(buf, COL_MAX_LEN,
affdba
             fd->abs_ts.secs, fd->abs_ts.nsecs / 1000000000, TO_STR_TIME_RES_T_SECS);
affdba
           break;
affdba
-      case TS_PREC_FIXED_DSEC:
affdba
-      case TS_PREC_AUTO_DSEC:
affdba
+      case WTAP_TSPREC_DSEC:
affdba
           display_epoch_time(buf, COL_MAX_LEN,
affdba
             fd->abs_ts.secs, fd->abs_ts.nsecs / 100000000, TO_STR_TIME_RES_T_DSECS);
affdba
           break;
affdba
-      case TS_PREC_FIXED_CSEC:
affdba
-      case TS_PREC_AUTO_CSEC:
affdba
+      case WTAP_TSPREC_CSEC:
affdba
           display_epoch_time(buf, COL_MAX_LEN,
affdba
             fd->abs_ts.secs, fd->abs_ts.nsecs / 10000000, TO_STR_TIME_RES_T_CSECS);
affdba
           break;
affdba
-      case TS_PREC_FIXED_MSEC:
affdba
-      case TS_PREC_AUTO_MSEC:
affdba
+      case WTAP_TSPREC_MSEC:
affdba
           display_epoch_time(buf, COL_MAX_LEN,
affdba
             fd->abs_ts.secs, fd->abs_ts.nsecs / 1000000, TO_STR_TIME_RES_T_MSECS);
affdba
           break;
affdba
-      case TS_PREC_FIXED_USEC:
affdba
-      case TS_PREC_AUTO_USEC:
affdba
+      case WTAP_TSPREC_USEC:
affdba
           display_epoch_time(buf, COL_MAX_LEN,
affdba
             fd->abs_ts.secs, fd->abs_ts.nsecs / 1000, TO_STR_TIME_RES_T_USECS);
affdba
           break;
affdba
-      case TS_PREC_FIXED_NSEC:
affdba
-      case TS_PREC_AUTO_NSEC:
affdba
+      case WTAP_TSPREC_NSEC:
affdba
           display_epoch_time(buf, COL_MAX_LEN,
affdba
             fd->abs_ts.secs, fd->abs_ts.nsecs, TO_STR_TIME_RES_T_NSECS);
affdba
           break;
affdba
@@ -1211,10 +1313,10 @@ set_fd_time(frame_data *fd, gchar *buf)
affdba
       if (fd->flags.has_ts) {
affdba
         switch (timestamp_get_seconds_type()) {
affdba
         case TS_SECONDS_DEFAULT:
affdba
-          set_time_seconds(&fd->rel_ts, buf);
affdba
+          set_time_seconds(fd, &fd->rel_ts, buf);
affdba
           break;
affdba
         case TS_SECONDS_HOUR_MIN_SEC:
affdba
-          set_time_seconds(&fd->rel_ts, buf);
affdba
+          set_time_seconds(fd, &fd->rel_ts, buf);
affdba
           break;
affdba
         default:
affdba
           g_assert_not_reached();
affdba
@@ -1232,10 +1334,10 @@ set_fd_time(frame_data *fd, gchar *buf)
affdba
 
affdba
         switch (timestamp_get_seconds_type()) {
affdba
         case TS_SECONDS_DEFAULT:
affdba
-          set_time_seconds(&del_cap_ts, buf);
affdba
+          set_time_seconds(fd, &del_cap_ts, buf);
affdba
           break;
affdba
         case TS_SECONDS_HOUR_MIN_SEC:
affdba
-          set_time_hour_min_sec(&del_cap_ts, buf);
affdba
+          set_time_hour_min_sec(fd, &del_cap_ts, buf);
affdba
           break;
affdba
         default:
affdba
           g_assert_not_reached();
affdba
@@ -1253,10 +1355,10 @@ set_fd_time(frame_data *fd, gchar *buf)
affdba
 
affdba
         switch (timestamp_get_seconds_type()) {
affdba
         case TS_SECONDS_DEFAULT:
affdba
-          set_time_seconds(&del_dis_ts, buf);
affdba
+          set_time_seconds(fd, &del_dis_ts, buf);
affdba
           break;
affdba
         case TS_SECONDS_HOUR_MIN_SEC:
affdba
-          set_time_hour_min_sec(&del_dis_ts, buf);
affdba
+          set_time_hour_min_sec(fd, &del_dis_ts, buf);
affdba
           break;
affdba
         default:
affdba
           g_assert_not_reached();
affdba
@@ -1400,38 +1502,33 @@ col_set_time(column_info *cinfo, const gint el, const nstime_t *ts, const char *
affdba
   for (col = cinfo->col_first[el]; col <= cinfo->col_last[el]; col++) {
affdba
     if (cinfo->fmt_matx[col][el]) {
affdba
       switch(timestamp_get_precision()) {
affdba
-    case TS_PREC_FIXED_SEC:
affdba
-    case TS_PREC_AUTO_SEC:
affdba
-      display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
affdba
-        (gint32) ts->secs, ts->nsecs / 1000000000, TO_STR_TIME_RES_T_SECS);
affdba
-      break;
affdba
-    case TS_PREC_FIXED_DSEC:
affdba
-    case TS_PREC_AUTO_DSEC:
affdba
-      display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
affdba
-        (gint32) ts->secs, ts->nsecs / 100000000, TO_STR_TIME_RES_T_DSECS);
affdba
-      break;
affdba
-    case TS_PREC_FIXED_CSEC:
affdba
-    case TS_PREC_AUTO_CSEC:
affdba
-      display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
affdba
-        (gint32) ts->secs, ts->nsecs / 10000000, TO_STR_TIME_RES_T_CSECS);
affdba
-      break;
affdba
-    case TS_PREC_FIXED_MSEC:
affdba
-    case TS_PREC_AUTO_MSEC:
affdba
-      display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
affdba
-        (gint32) ts->secs, ts->nsecs / 1000000, TO_STR_TIME_RES_T_MSECS);
affdba
-      break;
affdba
-    case TS_PREC_FIXED_USEC:
affdba
-    case TS_PREC_AUTO_USEC:
affdba
-      display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
affdba
-        (gint32) ts->secs, ts->nsecs / 1000, TO_STR_TIME_RES_T_USECS);
affdba
-      break;
affdba
-    case TS_PREC_FIXED_NSEC:
affdba
-    case TS_PREC_AUTO_NSEC:
affdba
-      display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
affdba
-        (gint32) ts->secs, ts->nsecs, TO_STR_TIME_RES_T_NSECS);
affdba
-      break;
affdba
-    default:
affdba
-      g_assert_not_reached();
affdba
+      case TS_PREC_FIXED_SEC:
affdba
+          display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
affdba
+            (gint32) ts->secs, ts->nsecs / 1000000000, TO_STR_TIME_RES_T_SECS);
affdba
+          break;
affdba
+      case TS_PREC_FIXED_DSEC:
affdba
+          display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
affdba
+            (gint32) ts->secs, ts->nsecs / 100000000, TO_STR_TIME_RES_T_DSECS);
affdba
+          break;
affdba
+      case TS_PREC_FIXED_CSEC:
affdba
+          display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
affdba
+            (gint32) ts->secs, ts->nsecs / 10000000, TO_STR_TIME_RES_T_CSECS);
affdba
+          break;
affdba
+      case TS_PREC_FIXED_MSEC:
affdba
+          display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
affdba
+            (gint32) ts->secs, ts->nsecs / 1000000, TO_STR_TIME_RES_T_MSECS);
affdba
+          break;
affdba
+      case TS_PREC_FIXED_USEC:
affdba
+          display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
affdba
+            (gint32) ts->secs, ts->nsecs / 1000, TO_STR_TIME_RES_T_USECS);
affdba
+          break;
affdba
+      case TS_PREC_FIXED_NSEC:
affdba
+      case TS_PREC_AUTO:    /* default to maximum */
affdba
+          display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
affdba
+            (gint32) ts->secs, ts->nsecs, TO_STR_TIME_RES_T_NSECS);
affdba
+          break;
affdba
+      default:
affdba
+          g_assert_not_reached();
affdba
       }
affdba
       cinfo->col_data[col] = cinfo->col_buf[col];
affdba
       cinfo->col_expr.col_expr[col] = fieldname;
affdba
diff --git a/epan/column.c b/epan/column.c
affdba
index 231f1c5..43da75f 100644
affdba
--- a/epan/column.c
affdba
+++ b/epan/column.c
affdba
@@ -254,28 +254,23 @@ get_timestamp_column_longest_string(const gint type, const gint precision)
affdba
     case(TS_ABSOLUTE_WITH_DATE):
affdba
     case(TS_UTC_WITH_DATE):
affdba
         switch(precision) {
affdba
-            case(TS_PREC_AUTO_SEC):
affdba
             case(TS_PREC_FIXED_SEC):
affdba
                 return "0000-00-00 00:00:00";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_DSEC):
affdba
             case(TS_PREC_FIXED_DSEC):
affdba
                 return "0000-00-00 00:00:00.0";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_CSEC):
affdba
             case(TS_PREC_FIXED_CSEC):
affdba
                 return "0000-00-00 00:00:00.00";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_MSEC):
affdba
             case(TS_PREC_FIXED_MSEC):
affdba
                 return "0000-00-00 00:00:00.000";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_USEC):
affdba
             case(TS_PREC_FIXED_USEC):
affdba
                 return "0000-00-00 00:00:00.000000";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_NSEC):
affdba
             case(TS_PREC_FIXED_NSEC):
affdba
+            case(TS_PREC_AUTO):    /* Leave enough room for the maximum */
affdba
                 return "0000-00-00 00:00:00.000000000";
affdba
                 break;
affdba
             default:
affdba
@@ -285,28 +280,23 @@ get_timestamp_column_longest_string(const gint type, const gint precision)
affdba
     case(TS_ABSOLUTE):
affdba
     case(TS_UTC):
affdba
         switch(precision) {
affdba
-            case(TS_PREC_AUTO_SEC):
affdba
             case(TS_PREC_FIXED_SEC):
affdba
                 return "00:00:00";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_DSEC):
affdba
             case(TS_PREC_FIXED_DSEC):
affdba
                 return "00:00:00.0";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_CSEC):
affdba
             case(TS_PREC_FIXED_CSEC):
affdba
                 return "00:00:00.00";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_MSEC):
affdba
             case(TS_PREC_FIXED_MSEC):
affdba
                 return "00:00:00.000";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_USEC):
affdba
             case(TS_PREC_FIXED_USEC):
affdba
                 return "00:00:00.000000";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_NSEC):
affdba
             case(TS_PREC_FIXED_NSEC):
affdba
+            case(TS_PREC_AUTO):    /* Leave enough room for the maximum */
affdba
                 return "00:00:00.000000000";
affdba
                 break;
affdba
             default:
affdba
@@ -317,28 +307,23 @@ get_timestamp_column_longest_string(const gint type, const gint precision)
affdba
     case(TS_DELTA):
affdba
     case(TS_DELTA_DIS):
affdba
         switch(precision) {
affdba
-            case(TS_PREC_AUTO_SEC):
affdba
             case(TS_PREC_FIXED_SEC):
affdba
                 return "0000";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_DSEC):
affdba
             case(TS_PREC_FIXED_DSEC):
affdba
                 return "0000.0";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_CSEC):
affdba
             case(TS_PREC_FIXED_CSEC):
affdba
                 return "0000.00";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_MSEC):
affdba
             case(TS_PREC_FIXED_MSEC):
affdba
                 return "0000.000";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_USEC):
affdba
             case(TS_PREC_FIXED_USEC):
affdba
                 return "0000.000000";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_NSEC):
affdba
             case(TS_PREC_FIXED_NSEC):
affdba
+            case(TS_PREC_AUTO):    /* Leave enough room for the maximum */
affdba
                 return "0000.000000000";
affdba
                 break;
affdba
             default:
affdba
@@ -348,28 +333,23 @@ get_timestamp_column_longest_string(const gint type, const gint precision)
affdba
     case(TS_EPOCH):
affdba
         /* This is enough to represent 2^63 (signed 64-bit integer) + fractions */
affdba
         switch(precision) {
affdba
-            case(TS_PREC_AUTO_SEC):
affdba
             case(TS_PREC_FIXED_SEC):
affdba
                 return "0000000000000000000";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_DSEC):
affdba
             case(TS_PREC_FIXED_DSEC):
affdba
                 return "0000000000000000000.0";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_CSEC):
affdba
             case(TS_PREC_FIXED_CSEC):
affdba
                 return "0000000000000000000.00";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_MSEC):
affdba
             case(TS_PREC_FIXED_MSEC):
affdba
                 return "0000000000000000000.000";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_USEC):
affdba
             case(TS_PREC_FIXED_USEC):
affdba
                 return "0000000000000000000.000000";
affdba
                 break;
affdba
-            case(TS_PREC_AUTO_NSEC):
affdba
             case(TS_PREC_FIXED_NSEC):
affdba
+            case(TS_PREC_AUTO):    /* Leave enough room for the maximum */
affdba
                 return "0000000000000000000.000000000";
affdba
                 break;
affdba
             default:
affdba
diff --git a/epan/frame_data.c b/epan/frame_data.c
affdba
index 63d9805..79b435e 100644
affdba
--- a/epan/frame_data.c
affdba
+++ b/epan/frame_data.c
affdba
@@ -269,6 +269,7 @@ frame_data_init(frame_data *fdata, guint32 num,
affdba
   fdata->flags.ignored = 0;
affdba
   fdata->flags.has_ts = (phdr->presence_flags & WTAP_HAS_TS) ? 1 : 0;
affdba
   fdata->flags.has_if_id = (phdr->presence_flags & WTAP_HAS_INTERFACE_ID) ? 1 : 0;
affdba
+  fdata->tsprec = (guint16)phdr->pkt_tsprec;
affdba
   fdata->flags.has_pack_flags = (phdr->presence_flags & WTAP_HAS_PACK_FLAGS) ? 1 : 0;
affdba
   fdata->color_filter = NULL;
affdba
   fdata->abs_ts.secs = phdr->ts.secs;
affdba
diff --git a/epan/frame_data.h b/epan/frame_data.h
affdba
index 580d238..2a73cdf 100644
affdba
--- a/epan/frame_data.h
affdba
+++ b/epan/frame_data.h
affdba
@@ -69,6 +69,7 @@ typedef struct _frame_data {
affdba
     unsigned int has_if_id      : 1; /**< 1 = has interface ID, 0 = no interface ID */
affdba
     unsigned int has_pack_flags : 1; /**< 1 = has packet flags, 0 = no packet flags */
affdba
   } flags;
affdba
+  gint16       tsprec;       /**< Time stamp precision */
affdba
 
affdba
   const void *color_filter;  /**< Per-packet matching color_filter_t object */
affdba
 
affdba
diff --git a/epan/timestamp.c b/epan/timestamp.c
affdba
index 155d8bb..65aa41c 100644
affdba
--- a/epan/timestamp.c
affdba
+++ b/epan/timestamp.c
affdba
@@ -30,7 +30,7 @@
affdba
  * and distinguish it from a command line value */
affdba
 static ts_type timestamp_type = TS_NOT_SET;
affdba
 
affdba
-static int timestamp_precision = TS_PREC_AUTO_USEC;
affdba
+static int timestamp_precision = TS_PREC_AUTO;
affdba
 
affdba
 static ts_seconds_type timestamp_seconds_type = TS_SECONDS_NOT_SET;
affdba
 
affdba
diff --git a/epan/timestamp.h b/epan/timestamp.h
affdba
index 0992b3e..3881696 100644
affdba
--- a/epan/timestamp.h
affdba
+++ b/epan/timestamp.h
affdba
@@ -52,19 +52,13 @@ typedef enum {
affdba
 } ts_type;
affdba
 
affdba
 typedef enum {
affdba
-	TS_PREC_AUTO,		/* recent */
affdba
-	TS_PREC_FIXED_SEC,	/* recent and internal */
affdba
-	TS_PREC_FIXED_DSEC,	/* recent and internal */
affdba
-	TS_PREC_FIXED_CSEC,	/* recent and internal */
affdba
-	TS_PREC_FIXED_MSEC,	/* recent and internal */
affdba
-	TS_PREC_FIXED_USEC,	/* recent and internal */
affdba
-	TS_PREC_FIXED_NSEC,	/* recent and internal */
affdba
-	TS_PREC_AUTO_SEC,	/* internal */
affdba
-	TS_PREC_AUTO_DSEC,	/* internal */
affdba
-	TS_PREC_AUTO_CSEC,	/* internal */
affdba
-	TS_PREC_AUTO_MSEC,	/* internal */
affdba
-	TS_PREC_AUTO_USEC,	/* internal */
affdba
-	TS_PREC_AUTO_NSEC	/* internal */
affdba
+	TS_PREC_AUTO,
affdba
+	TS_PREC_FIXED_SEC,
affdba
+	TS_PREC_FIXED_DSEC,
affdba
+	TS_PREC_FIXED_CSEC,
affdba
+	TS_PREC_FIXED_MSEC,
affdba
+	TS_PREC_FIXED_USEC,
affdba
+	TS_PREC_FIXED_NSEC,
affdba
 } ts_precision;
affdba
 
affdba
 typedef enum {
affdba
diff --git a/epan/wslua/make-init-lua.pl b/epan/wslua/make-init-lua.pl
affdba
index 878faf5..e9f186d 100755
affdba
--- a/epan/wslua/make-init-lua.pl
affdba
+++ b/epan/wslua/make-init-lua.pl
affdba
@@ -33,6 +33,7 @@ my $WSROOT = shift;
affdba
 die "'$WSROOT' is not a directory" unless -d $WSROOT;
affdba
 
affdba
 my $wtap_encaps_table = '';
affdba
+my $wtap_tsprecs_table = '';
affdba
 my $wtap_filetypes_table = '';
affdba
 my $ft_types_table = '';
affdba
 my $bases_table = '';
affdba
@@ -42,6 +43,7 @@ my $menu_groups = '';
affdba
 
affdba
 my %replacements = %{{
affdba
     WTAP_ENCAPS => \$wtap_encaps_table,
affdba
+    WTAP_TSPRECS => \$wtap_tsprecs_table,
affdba
     WTAP_FILETYPES => \$wtap_filetypes_table,
affdba
     FT_TYPES => \$ft_types_table,
affdba
     BASES => \$bases_table,
affdba
@@ -69,6 +71,7 @@ close TEMPLATE;
affdba
 #
affdba
 
affdba
 $wtap_encaps_table = "-- Wiretap encapsulations XXX\nwtap_encaps = {\n";
affdba
+$wtap_tsprecs_table = "-- Wiretap timestamp precision types\nwtap_tsprecs = {\n";
affdba
 $wtap_filetypes_table = "-- Wiretap file types\nwtap_filetypes = {\n";
affdba
 
affdba
 open WTAP_H, "< $WSROOT/wiretap/wtap.h" or die "cannot open '$WSROOT/wiretap/wtap.h':  $!";
affdba
@@ -81,10 +84,17 @@ while(<WTAP_H>) {
affdba
     if ( /^#define WTAP_FILE_([A-Z0-9_]+)\s+(\d+)/ ) {
affdba
         $wtap_filetypes_table .= "\t[\"$1\"] = $2,\n";
affdba
     }
affdba
+
affdba
+    if ( /^#define WTAP_TSPREC_([A-Z0-9_]+)\s+(\d+)/ ) {
affdba
+        $wtap_tsprecs_table .= "\t[\"$1\"] = $2,\n";
affdba
+        # for backwards compatibility we need to add them to the filetypes table too
affdba
+        $wtap_filetypes_table .= "\t[\"TSPREC_$1\"] = $2,\n";
affdba
+    }
affdba
 }
affdba
 
affdba
 $wtap_encaps_table =~ s/,\n$/\n}\nwtap = wtap_encaps -- for bw compatibility\n/msi;
affdba
 $wtap_filetypes_table =~ s/,\n$/\n}\n/msi;
affdba
+$wtap_tsprecs_table =~ s/,\n$/\n}\n/msi;
affdba
 
affdba
 #
affdba
 # Extract values from epan/ftypes/ftypes.h:
affdba
diff --git a/epan/wslua/template-init.lua b/epan/wslua/template-init.lua
affdba
index 2538c4c..31f298e 100644
affdba
--- a/epan/wslua/template-init.lua
affdba
+++ b/epan/wslua/template-init.lua
affdba
@@ -66,6 +66,8 @@ end
affdba
 
affdba
 -- %WTAP_ENCAPS%
affdba
 
affdba
+-- %WTAP_TSPRECS%
affdba
+
affdba
 -- %WTAP_FILETYPES%
affdba
 
affdba
 -- %FT_TYPES%
affdba
diff --git a/file.c b/file.c
affdba
index 5059e0b..6db3c68 100644
affdba
--- a/file.c
affdba
+++ b/file.c
affdba
@@ -222,7 +222,6 @@ void
affdba
 cf_timestamp_auto_precision(capture_file *cf)
affdba
 {
affdba
   int i;
affdba
-  int prec = timestamp_get_precision();
affdba
 
affdba
 
affdba
   /* don't try to get the file's precision if none is opened */
affdba
@@ -230,38 +229,6 @@ cf_timestamp_auto_precision(capture_file *cf)
affdba
     return;
affdba
   }
affdba
 
affdba
-  /* if we are in auto mode, set precision of current file */
affdba
-  if (prec == TS_PREC_AUTO ||
affdba
-     prec == TS_PREC_AUTO_SEC ||
affdba
-     prec == TS_PREC_AUTO_DSEC ||
affdba
-     prec == TS_PREC_AUTO_CSEC ||
affdba
-     prec == TS_PREC_AUTO_MSEC ||
affdba
-     prec == TS_PREC_AUTO_USEC ||
affdba
-     prec == TS_PREC_AUTO_NSEC)
affdba
-  {
affdba
-    switch(wtap_file_tsprecision(cf->wth)) {
affdba
-    case(WTAP_FILE_TSPREC_SEC):
affdba
-      timestamp_set_precision(TS_PREC_AUTO_SEC);
affdba
-      break;
affdba
-    case(WTAP_FILE_TSPREC_DSEC):
affdba
-      timestamp_set_precision(TS_PREC_AUTO_DSEC);
affdba
-      break;
affdba
-    case(WTAP_FILE_TSPREC_CSEC):
affdba
-      timestamp_set_precision(TS_PREC_AUTO_CSEC);
affdba
-      break;
affdba
-    case(WTAP_FILE_TSPREC_MSEC):
affdba
-      timestamp_set_precision(TS_PREC_AUTO_MSEC);
affdba
-      break;
affdba
-    case(WTAP_FILE_TSPREC_USEC):
affdba
-      timestamp_set_precision(TS_PREC_AUTO_USEC);
affdba
-      break;
affdba
-    case(WTAP_FILE_TSPREC_NSEC):
affdba
-      timestamp_set_precision(TS_PREC_AUTO_NSEC);
affdba
-      break;
affdba
-    default:
affdba
-      g_assert_not_reached();
affdba
-    }
affdba
-  }
affdba
   /* Set the column widths of those columns that show the time in
affdba
      "command-line-specified" format. */
affdba
   for (i = 0; i < cf->cinfo.num_cols; i++) {
affdba
diff --git a/rawshark.c b/rawshark.c
affdba
index dbb9f42..1d2ff97 100644
affdba
--- a/rawshark.c
affdba
+++ b/rawshark.c
affdba
@@ -832,35 +832,6 @@ main(int argc, char *argv[])
affdba
             }
affdba
         }
affdba
 
affdba
-        /* Set timestamp precision; there should arguably be a command-line
affdba
-           option to let the user set this. */
affdba
-#if 0
affdba
-        switch(wtap_file_tsprecision(cfile.wth)) {
affdba
-            case(WTAP_FILE_TSPREC_SEC):
affdba
-                timestamp_set_precision(TS_PREC_AUTO_SEC);
affdba
-                break;
affdba
-            case(WTAP_FILE_TSPREC_DSEC):
affdba
-                timestamp_set_precision(TS_PREC_AUTO_DSEC);
affdba
-                break;
affdba
-            case(WTAP_FILE_TSPREC_CSEC):
affdba
-                timestamp_set_precision(TS_PREC_AUTO_CSEC);
affdba
-                break;
affdba
-            case(WTAP_FILE_TSPREC_MSEC):
affdba
-                timestamp_set_precision(TS_PREC_AUTO_MSEC);
affdba
-                break;
affdba
-            case(WTAP_FILE_TSPREC_USEC):
affdba
-                timestamp_set_precision(TS_PREC_AUTO_USEC);
affdba
-                break;
affdba
-            case(WTAP_FILE_TSPREC_NSEC):
affdba
-                timestamp_set_precision(TS_PREC_AUTO_NSEC);
affdba
-                break;
affdba
-            default:
affdba
-                g_assert_not_reached();
affdba
-        }
affdba
-#else
affdba
-        timestamp_set_precision(TS_PREC_AUTO_USEC);
affdba
-#endif
affdba
-
affdba
         /* Process the packets in the file */
affdba
         err = load_cap_file(&cfile);
affdba
 
affdba
diff --git a/tshark.c b/tshark.c
affdba
index 98b95bf..8c8de07 100644
affdba
--- a/tshark.c
affdba
+++ b/tshark.c
affdba
@@ -1903,31 +1903,6 @@ main(int argc, char *argv[])
affdba
       return 2;
affdba
     }
affdba
 
affdba
-    /* Set timestamp precision; there should arguably be a command-line
affdba
-       option to let the user set this. */
affdba
-    switch(wtap_file_tsprecision(cfile.wth)) {
affdba
-    case(WTAP_FILE_TSPREC_SEC):
affdba
-      timestamp_set_precision(TS_PREC_AUTO_SEC);
affdba
-      break;
affdba
-    case(WTAP_FILE_TSPREC_DSEC):
affdba
-      timestamp_set_precision(TS_PREC_AUTO_DSEC);
affdba
-      break;
affdba
-    case(WTAP_FILE_TSPREC_CSEC):
affdba
-      timestamp_set_precision(TS_PREC_AUTO_CSEC);
affdba
-      break;
affdba
-    case(WTAP_FILE_TSPREC_MSEC):
affdba
-      timestamp_set_precision(TS_PREC_AUTO_MSEC);
affdba
-      break;
affdba
-    case(WTAP_FILE_TSPREC_USEC):
affdba
-      timestamp_set_precision(TS_PREC_AUTO_USEC);
affdba
-      break;
affdba
-    case(WTAP_FILE_TSPREC_NSEC):
affdba
-      timestamp_set_precision(TS_PREC_AUTO_NSEC);
affdba
-      break;
affdba
-    default:
affdba
-      g_assert_not_reached();
affdba
-    }
affdba
-
affdba
     /* Process the packets in the file */
affdba
     TRY {
affdba
 #ifdef HAVE_LIBPCAP
affdba
@@ -2030,9 +2005,6 @@ main(int argc, char *argv[])
affdba
       }
affdba
     }
affdba
 
affdba
-    /* For now, assume libpcap gives microsecond precision. */
affdba
-    timestamp_set_precision(TS_PREC_AUTO_USEC);
affdba
-
affdba
     /*
affdba
      * XXX - this returns FALSE if an error occurred, but it also
affdba
      * returns FALSE if the capture stops because a time limit
affdba
diff --git a/ui/cli/tap-comparestat.c b/ui/cli/tap-comparestat.c
affdba
index 6f55926..d449f32 100644
affdba
--- a/ui/cli/tap-comparestat.c
affdba
+++ b/ui/cli/tap-comparestat.c
affdba
@@ -545,8 +545,6 @@ comparestat_init(const char *optarg, void* userdata _U_)
affdba
 	cs->zebra_time.secs=0;
affdba
 	cs->zebra_time.nsecs=1;
affdba
 	cs->nr_tree=se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "nr_tree");
affdba
-	/* microsecond precision */
affdba
-	timestamp_set_precision(TS_PREC_AUTO_NSEC);
affdba
 
affdba
 	if(filter){
affdba
 		cs->filter=g_strdup(filter);
affdba
diff --git a/ui/gtk/compare_stat.c b/ui/gtk/compare_stat.c
affdba
index e07ee96..b8ad2b2 100644
affdba
--- a/ui/gtk/compare_stat.c
affdba
+++ b/ui/gtk/compare_stat.c
affdba
@@ -584,8 +584,6 @@ comparestat_draw(void *arg)
affdba
 	second_file_amount=cs->second_file_amount;
affdba
 	/* reset after numbering */
affdba
 	cs->nr_tree=se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "nr_tree");
affdba
-	/* microsecond precision for Info column*/
affdba
-	timestamp_set_precision(TS_PREC_AUTO_NSEC);
affdba
 	/* reset ordering */
affdba
 	nstime_set_unset(&cs->current_time);
affdba
 
affdba
@@ -738,8 +736,6 @@ gtk_comparestat_init(const char *opt_arg, void* userdata _U_)
affdba
 	cs->zebra_time.secs=0;
affdba
 	cs->zebra_time.nsecs=1;
affdba
 	cs->nr_tree=se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "nr_tree");
affdba
-	/* microsecond precision */
affdba
-	timestamp_set_precision(TS_PREC_AUTO_NSEC);
affdba
 
affdba
 	/* transient_for top_level */
affdba
 	cs->win=dlg_window_new("compare-stat");
affdba
diff --git a/ui/gtk/main_menubar.c b/ui/gtk/main_menubar.c
affdba
index 23ceff2..dd83125 100644
affdba
--- a/ui/gtk/main_menubar.c
affdba
+++ b/ui/gtk/main_menubar.c
affdba
@@ -635,11 +635,7 @@ timestamp_precision_new_cb (GtkRadioAction *action, GtkRadioAction *current _U_,
affdba
     value = gtk_radio_action_get_current_value (action);
affdba
     if (recent.gui_time_precision != value) {
affdba
         /* the actual precision will be set in packet_list_queue_draw() below */
affdba
-        if (value == TS_PREC_AUTO) {
affdba
-            timestamp_set_precision(TS_PREC_AUTO_SEC);
affdba
-        } else {
affdba
-            timestamp_set_precision(value);
affdba
-        }
affdba
+        timestamp_set_precision(value);
affdba
         recent.gui_time_precision  = value;
affdba
         /* This call adjusts column width */
affdba
         cf_timestamp_auto_precision(&cfile);
affdba
@@ -1818,7 +1814,7 @@ static const GtkRadioActionEntry main_menu_bar_radio_view_time_entries [] =
affdba
 static const GtkRadioActionEntry main_menu_bar_radio_view_time_fileformat_prec_entries [] =
affdba
 {
affdba
     /* name, stock id, label, accel, tooltip,  value */
affdba
-    { "/View/TimeDisplayFormat/FileFormatPrecision-Automatic",      NULL, "Automatic (File Format Precision)",  NULL, NULL, TS_PREC_AUTO },
affdba
+    { "/View/TimeDisplayFormat/FileFormatPrecision-Automatic",      NULL, "Automatic (use precision indicated in the file)",  NULL, NULL, TS_PREC_AUTO },
affdba
     { "/View/TimeDisplayFormat/FileFormatPrecision-Seconds",        NULL, "Seconds:   0",                       NULL, NULL, TS_PREC_FIXED_SEC },
affdba
     { "/View/TimeDisplayFormat/FileFormatPrecision-Deciseconds",    NULL, "Deciseconds:   0.1",                 NULL, NULL, TS_PREC_FIXED_DSEC },
affdba
     { "/View/TimeDisplayFormat/FileFormatPrecision-Centiseconds",   NULL, "Centiseconds:  0.12",                NULL, NULL, TS_PREC_FIXED_CSEC },
affdba
@@ -4634,8 +4630,8 @@ menu_recent_read_finished(void)
affdba
     cf_timestamp_auto_precision(&cfile);
affdba
     packet_list_queue_draw();
affdba
     /* the actual precision will be set in packet_list_queue_draw() below */
affdba
-    if (recent.gui_time_precision == TS_PREC_AUTO) {
affdba
-        timestamp_set_precision(TS_PREC_AUTO_SEC);
affdba
+    if (recent.gui_time_precision > TS_PREC_FIXED_NSEC) {
affdba
+        timestamp_set_precision(TS_PREC_AUTO);
affdba
     } else {
affdba
         timestamp_set_precision(recent.gui_time_precision);
affdba
     }
affdba
diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp
affdba
index 12b0e81..3193702 100644
affdba
--- a/ui/qt/main.cpp
affdba
+++ b/ui/qt/main.cpp
affdba
@@ -856,7 +856,7 @@ int main(int argc, char *argv[])
affdba
 
affdba
     g_log(NULL, G_LOG_LEVEL_DEBUG, "FIX: timestamp types should be set elsewhere");
affdba
     timestamp_set_type(TS_RELATIVE);
affdba
-    timestamp_set_precision(TS_PREC_AUTO_USEC);
affdba
+    timestamp_set_precision(TS_PREC_AUTO);
affdba
     timestamp_set_seconds_type(TS_SECONDS_DEFAULT);
affdba
 
affdba
 /////////
affdba
diff --git a/wiretap/5views.c b/wiretap/5views.c
affdba
index e8dd0b8..c7a9078 100644
affdba
--- a/wiretap/5views.c
affdba
+++ b/wiretap/5views.c
affdba
@@ -191,7 +191,7 @@ int _5views_open(wtap *wth, int *err, gchar **err_info)
affdba
 	wth->subtype_seek_read = _5views_seek_read;
affdba
 	wth->file_encap = encap;
affdba
 	wth->snapshot_length = 0;	/* not available in header */
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_NSEC;
affdba
 
affdba
 	return 1;
affdba
 }
affdba
diff --git a/wiretap/aethra.c b/wiretap/aethra.c
affdba
index d04bf8d..02d1b6c 100644
affdba
--- a/wiretap/aethra.c
affdba
+++ b/wiretap/aethra.c
affdba
@@ -178,7 +178,7 @@ int aethra_open(wtap *wth, int *err, gchar **err_info)
affdba
 	 */
affdba
 	wth->file_encap = WTAP_ENCAP_ISDN;
affdba
 	wth->snapshot_length = 0;	/* not available in header */
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_MSEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_MSEC;
affdba
 	return 1;
affdba
 }
affdba
 
affdba
diff --git a/wiretap/ascendtext.c b/wiretap/ascendtext.c
affdba
index d0b4e76..a05fe34 100644
affdba
--- a/wiretap/ascendtext.c
affdba
+++ b/wiretap/ascendtext.c
affdba
@@ -229,7 +229,7 @@ int ascend_open(wtap *wth, int *err, gchar **err_info)
affdba
   }
affdba
   ascend->inittime = statbuf.st_ctime;
affdba
   ascend->adjusted = 0;
affdba
-  wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+  wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 
affdba
   init_parse_ascend();
affdba
 
affdba
diff --git a/wiretap/ber.c b/wiretap/ber.c
affdba
index 990db1d..6904367 100644
affdba
--- a/wiretap/ber.c
affdba
+++ b/wiretap/ber.c
affdba
@@ -192,7 +192,7 @@ int ber_open(wtap *wth, int *err, gchar **err_info)
affdba
 
affdba
   wth->subtype_read = ber_read;
affdba
   wth->subtype_seek_read = ber_seek_read;
affdba
-  wth->tsprecision = WTAP_FILE_TSPREC_SEC;
affdba
+  wth->file_tsprec = WTAP_TSPREC_SEC;
affdba
 
affdba
   return 1;
affdba
 }
affdba
diff --git a/wiretap/btsnoop.c b/wiretap/btsnoop.c
affdba
index 042cc8b..1a2e8ac 100644
affdba
--- a/wiretap/btsnoop.c
affdba
+++ b/wiretap/btsnoop.c
affdba
@@ -147,7 +147,7 @@ int btsnoop_open(wtap *wth, int *err, gchar **err_info)
affdba
 	wth->subtype_seek_read = btsnoop_seek_read;
affdba
 	wth->file_encap = file_encap;
affdba
 	wth->snapshot_length = 0;	/* not available in header */
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 	wth->file_type = WTAP_FILE_BTSNOOP;
affdba
 	return 1;
affdba
 }
affdba
@@ -443,7 +443,7 @@ gboolean btsnoop_dump_open_h1(wtap_dumper *wdh, int *err)
affdba
     switch (wdh->file_type) {
affdba
 
affdba
     case WTAP_FILE_BTSNOOP:
affdba
-        wdh->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+        wdh->tsprecision = WTAP_TSPREC_USEC;
affdba
         break;
affdba
 
affdba
     default:
affdba
@@ -485,7 +485,7 @@ gboolean btsnoop_dump_open_h4(wtap_dumper *wdh, int *err)
affdba
     switch (wdh->file_type) {
affdba
 
affdba
     case WTAP_FILE_BTSNOOP:
affdba
-        wdh->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+        wdh->tsprecision = WTAP_TSPREC_USEC;
affdba
         break;
affdba
 
affdba
     default:
affdba
diff --git a/wiretap/camins.c b/wiretap/camins.c
affdba
index 879b68d..3c7a608 100644
affdba
--- a/wiretap/camins.c
affdba
+++ b/wiretap/camins.c
affdba
@@ -372,7 +372,7 @@ int camins_open(wtap *wth, int *err, gchar **err_info _U_)
affdba
 
affdba
    wth->file_encap = WTAP_ENCAP_DVBCI;
affdba
    wth->snapshot_length = 0;
affdba
-   wth->tsprecision = WTAP_FILE_TSPREC_MSEC;
affdba
+   wth->file_tsprec = WTAP_TSPREC_MSEC;
affdba
 
affdba
    wth->priv = NULL;
affdba
 
affdba
diff --git a/wiretap/catapult_dct2000.c b/wiretap/catapult_dct2000.c
affdba
index a17ab0d..b389d2a 100644
affdba
--- a/wiretap/catapult_dct2000.c
affdba
+++ b/wiretap/catapult_dct2000.c
affdba
@@ -262,7 +262,7 @@ catapult_dct2000_open(wtap *wth, int *err, gchar **err_info)
affdba
     wth->subtype_close = catapult_dct2000_close;
affdba
 
affdba
     /* Choose microseconds (have 4 decimal places...) */
affdba
-    wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+    wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 
affdba
 
affdba
     /***************************************************************/
affdba
diff --git a/wiretap/commview.c b/wiretap/commview.c
affdba
index 935d15f..f85b1c8 100644
affdba
--- a/wiretap/commview.c
affdba
+++ b/wiretap/commview.c
affdba
@@ -126,7 +126,7 @@ int commview_open(wtap *wth, int *err, gchar **err_info)
affdba
 
affdba
 	wth->file_type = WTAP_FILE_COMMVIEW;
affdba
 	wth->file_encap = WTAP_ENCAP_PER_PACKET;
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 
affdba
 	return 1; /* Our kind of file */
affdba
 }
affdba
diff --git a/wiretap/cosine.c b/wiretap/cosine.c
affdba
index d6db197..76892b2 100644
affdba
--- a/wiretap/cosine.c
affdba
+++ b/wiretap/cosine.c
affdba
@@ -282,7 +282,7 @@ int cosine_open(wtap *wth, int *err, gchar **err_info)
affdba
 	wth->snapshot_length = 0; /* not known */
affdba
 	wth->subtype_read = cosine_read;
affdba
 	wth->subtype_seek_read = cosine_seek_read;
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_CSEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_CSEC;
affdba
 
affdba
 	return 1;
affdba
 }
affdba
diff --git a/wiretap/csids.c b/wiretap/csids.c
affdba
index a60fd11..30702b4 100644
affdba
--- a/wiretap/csids.c
affdba
+++ b/wiretap/csids.c
affdba
@@ -139,7 +139,7 @@ int csids_open(wtap *wth, int *err, gchar **err_info)
affdba
   wth->snapshot_length = 0; /* not known */
affdba
   wth->subtype_read = csids_read;
affdba
   wth->subtype_seek_read = csids_seek_read;
affdba
-  wth->tsprecision = WTAP_FILE_TSPREC_SEC;
affdba
+  wth->file_tsprec = WTAP_TSPREC_SEC;
affdba
 
affdba
   return 1;
affdba
 }
affdba
diff --git a/wiretap/daintree-sna.c b/wiretap/daintree-sna.c
affdba
index a9edc71..4c79217 100644
affdba
--- a/wiretap/daintree-sna.c
affdba
+++ b/wiretap/daintree-sna.c
affdba
@@ -125,7 +125,7 @@ int daintree_sna_open(wtap *wth, int *err, gchar **err_info)
affdba
 	/* set up for file type */
affdba
 	wth->file_type = WTAP_FILE_DAINTREE_SNA;
affdba
 	wth->file_encap = WTAP_ENCAP_IEEE802_15_4_NOFCS;
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 	wth->snapshot_length = 0; /* not available in header */
affdba
 
affdba
 	return 1; /* it's a Daintree file */
affdba
diff --git a/wiretap/dbs-etherwatch.c b/wiretap/dbs-etherwatch.c
affdba
index 11ab38a..cc3d0c3 100644
affdba
--- a/wiretap/dbs-etherwatch.c
affdba
+++ b/wiretap/dbs-etherwatch.c
affdba
@@ -192,7 +192,7 @@ int dbs_etherwatch_open(wtap *wth, int *err, gchar **err_info)
affdba
 	wth->snapshot_length = 0;	/* not known */
affdba
 	wth->subtype_read = dbs_etherwatch_read;
affdba
 	wth->subtype_seek_read = dbs_etherwatch_seek_read;
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_CSEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_CSEC;
affdba
 
affdba
 	return 1;
affdba
 }
affdba
diff --git a/wiretap/dct3trace.c b/wiretap/dct3trace.c
affdba
index e2285ec..94e1012 100644
affdba
--- a/wiretap/dct3trace.c
affdba
+++ b/wiretap/dct3trace.c
affdba
@@ -181,7 +181,7 @@ int dct3trace_open(wtap *wth, int *err, gchar **err_info)
affdba
 	wth->snapshot_length = 0; /* not known */
affdba
 	wth->subtype_read = dct3trace_read;
affdba
 	wth->subtype_seek_read = dct3trace_seek_read;
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_SEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_SEC;
affdba
 
affdba
 	return 1;
affdba
 }
affdba
diff --git a/wiretap/erf.c b/wiretap/erf.c
affdba
index 6fe4847..d762745 100644
affdba
--- a/wiretap/erf.c
affdba
+++ b/wiretap/erf.c
affdba
@@ -274,7 +274,7 @@ extern int erf_open(wtap *wth, int *err, gchar **err_info)
affdba
 
affdba
   wth->subtype_read = erf_read;
affdba
   wth->subtype_seek_read = erf_seek_read;
affdba
-  wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+  wth->file_tsprec = WTAP_TSPREC_NSEC;
affdba
 
affdba
   erf_populate_interfaces(wth);
affdba
 
affdba
@@ -698,7 +698,7 @@ int erf_dump_open(wtap_dumper *wdh, int *err)
affdba
 
affdba
   switch(wdh->file_type){
affdba
     case WTAP_FILE_ERF:
affdba
-      wdh->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+      wdh->tsprecision = WTAP_TSPREC_NSEC;
affdba
       break;
affdba
     default:
affdba
       *err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
affdba
diff --git a/wiretap/eyesdn.c b/wiretap/eyesdn.c
affdba
index c32f5b8..5ff55df 100644
affdba
--- a/wiretap/eyesdn.c
affdba
+++ b/wiretap/eyesdn.c
affdba
@@ -148,7 +148,7 @@ int eyesdn_open(wtap *wth, int *err, gchar **err_info)
affdba
 	wth->snapshot_length = 0; /* not known */
affdba
 	wth->subtype_read = eyesdn_read;
affdba
 	wth->subtype_seek_read = eyesdn_seek_read;
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 
affdba
 	return 1;
affdba
 }
affdba
diff --git a/wiretap/file_access.c b/wiretap/file_access.c
affdba
index cbea1af..640b867 100644
affdba
--- a/wiretap/file_access.c
affdba
+++ b/wiretap/file_access.c
affdba
@@ -357,7 +357,7 @@ wtap* wtap_open_offline(const char *filename, int *err, char **err_info,
affdba
 	wth->file_encap = WTAP_ENCAP_UNKNOWN;
affdba
 	wth->subtype_sequential_close = NULL;
affdba
 	wth->subtype_close = NULL;
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 	wth->priv = NULL;
affdba
 
affdba
 	init_open_routines();
affdba
diff --git a/wiretap/hcidump.c b/wiretap/hcidump.c
affdba
index 50c37c1..f7b839f 100644
affdba
--- a/wiretap/hcidump.c
affdba
+++ b/wiretap/hcidump.c
affdba
@@ -157,7 +157,7 @@ int hcidump_open(wtap *wth, int *err, gchar **err_info)
affdba
 
affdba
 	wth->subtype_read = hcidump_read;
affdba
 	wth->subtype_seek_read = hcidump_seek_read;
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 
affdba
 	return 1;
affdba
 }
affdba
diff --git a/wiretap/i4btrace.c b/wiretap/i4btrace.c
affdba
index 5cabbfe..e0e4f4a 100644
affdba
--- a/wiretap/i4btrace.c
affdba
+++ b/wiretap/i4btrace.c
affdba
@@ -112,7 +112,7 @@ int i4btrace_open(wtap *wth, int *err, gchar **err_info)
affdba
 	i4btrace->byte_swapped = byte_swapped;
affdba
 
affdba
 	wth->file_encap = WTAP_ENCAP_ISDN;
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 
affdba
 	return 1;
affdba
 }
affdba
diff --git a/wiretap/ipfix.c b/wiretap/ipfix.c
affdba
index 9a65680..97d4529 100644
affdba
--- a/wiretap/ipfix.c
affdba
+++ b/wiretap/ipfix.c
affdba
@@ -239,7 +239,7 @@ ipfix_open(wtap *wth, int *err, gchar **err_info)
affdba
     /* all's good, this is a IPFIX file */
affdba
     wth->file_encap = WTAP_ENCAP_RAW_IPFIX;
affdba
     wth->snapshot_length = 0;
affdba
-    wth->tsprecision = WTAP_FILE_TSPREC_SEC;
affdba
+    wth->file_tsprec = WTAP_TSPREC_SEC;
affdba
     wth->subtype_read = ipfix_read;
affdba
     wth->subtype_seek_read = ipfix_seek_read;
affdba
     wth->subtype_close = ipfix_close;
affdba
diff --git a/wiretap/iptrace.c b/wiretap/iptrace.c
affdba
index 152e008..aad4b3c 100644
affdba
--- a/wiretap/iptrace.c
affdba
+++ b/wiretap/iptrace.c
affdba
@@ -72,13 +72,13 @@ int iptrace_open(wtap *wth, int *err, gchar **err_info)
affdba
 		wth->file_type = WTAP_FILE_IPTRACE_1_0;
affdba
 		wth->subtype_read = iptrace_read_1_0;
affdba
 		wth->subtype_seek_read = iptrace_seek_read_1_0;
affdba
-		wth->tsprecision = WTAP_FILE_TSPREC_SEC;
affdba
+		wth->file_tsprec = WTAP_TSPREC_SEC;
affdba
 	}
affdba
 	else if (strcmp(name, "iptrace 2.0") == 0) {
affdba
 		wth->file_type = WTAP_FILE_IPTRACE_2_0;
affdba
 		wth->subtype_read = iptrace_read_2_0;
affdba
 		wth->subtype_seek_read = iptrace_seek_read_2_0;
affdba
-		wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+		wth->file_tsprec = WTAP_TSPREC_NSEC;
affdba
 	}
affdba
 	else {
affdba
 		return 0;
affdba
diff --git a/wiretap/iseries.c b/wiretap/iseries.c
affdba
index e31d5ec..8d5e111 100644
affdba
--- a/wiretap/iseries.c
affdba
+++ b/wiretap/iseries.c
affdba
@@ -250,7 +250,7 @@ iseries_open (wtap * wth, int *err, gchar ** err_info)
affdba
         wth->snapshot_length   = 0;
affdba
         wth->subtype_read      = iseries_read;
affdba
         wth->subtype_seek_read = iseries_seek_read;
affdba
-        wth->tsprecision       = WTAP_FILE_TSPREC_USEC;
affdba
+        wth->file_tsprec       = WTAP_TSPREC_USEC;
affdba
 
affdba
         if (file_seek (wth->fh, 0, SEEK_SET, err) == -1)
affdba
           {
affdba
@@ -290,7 +290,7 @@ iseries_open (wtap * wth, int *err, gchar ** err_info)
affdba
             wth->snapshot_length   = 0;
affdba
             wth->subtype_read      = iseries_read;
affdba
             wth->subtype_seek_read = iseries_seek_read;
affdba
-            wth->tsprecision       = WTAP_FILE_TSPREC_USEC;
affdba
+            wth->file_tsprec       = WTAP_TSPREC_USEC;
affdba
 
affdba
             if (file_seek (wth->fh, 0, SEEK_SET, err) == -1)
affdba
               {
affdba
diff --git a/wiretap/k12.c b/wiretap/k12.c
affdba
index 85db119..5923eb9 100644
affdba
--- a/wiretap/k12.c
affdba
+++ b/wiretap/k12.c
affdba
@@ -832,7 +832,7 @@ int k12_open(wtap *wth, int *err, gchar **err_info) {
affdba
     wth->subtype_seek_read = k12_seek_read;
affdba
     wth->subtype_close = k12_close;
affdba
     wth->priv = (void *)file_data;
affdba
-    wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+    wth->file_tsprec = WTAP_TSPREC_NSEC;
affdba
 
affdba
     return 1;
affdba
 }
affdba
diff --git a/wiretap/k12text.l b/wiretap/k12text.l
affdba
index 817eb92..fdfd3a7 100644
affdba
--- a/wiretap/k12text.l
affdba
+++ b/wiretap/k12text.l
affdba
@@ -351,7 +351,7 @@ k12text_open(wtap *wth, int *err, gchar **err_info _U_)
affdba
 	wth->snapshot_length = 0;
affdba
 	wth->subtype_read = k12text_read;
affdba
 	wth->subtype_seek_read = k12text_seek_read;
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_NSEC;
affdba
 
affdba
 	return 1;
affdba
 }
affdba
diff --git a/wiretap/lanalyzer.c b/wiretap/lanalyzer.c
affdba
index eb83872..35dad96 100644
affdba
--- a/wiretap/lanalyzer.c
affdba
+++ b/wiretap/lanalyzer.c
affdba
@@ -348,7 +348,7 @@ int lanalyzer_open(wtap *wth, int *err, gchar **err_info)
affdba
 	wth->subtype_read = lanalyzer_read;
affdba
 	wth->subtype_seek_read = lanalyzer_seek_read;
affdba
 	wth->snapshot_length = 0;
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_NSEC;
affdba
 
affdba
 	/* Read records until we find the start of packets */
affdba
 	while (1) {
affdba
diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c
affdba
index 47dafc7..5477073 100644
affdba
--- a/wiretap/libpcap.c
affdba
+++ b/wiretap/libpcap.c
affdba
@@ -107,7 +107,7 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info)
affdba
 		   a program using either standard or ss990417 libpcap. */
affdba
 		byte_swapped = FALSE;
affdba
 		modified = FALSE;
affdba
-		wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+		wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 		break;
affdba
 
affdba
 	case PCAP_MODIFIED_MAGIC:
affdba
@@ -115,7 +115,7 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info)
affdba
 		   a program using either ss990915 or ss991029 libpcap. */
affdba
 		byte_swapped = FALSE;
affdba
 		modified = TRUE;
affdba
-		wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+		wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 		break;
affdba
 
affdba
 	case PCAP_SWAPPED_MAGIC:
affdba
@@ -124,7 +124,7 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info)
affdba
 		   ss990417 libpcap. */
affdba
 		byte_swapped = TRUE;
affdba
 		modified = FALSE;
affdba
-		wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+		wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 		break;
affdba
 
affdba
 	case PCAP_SWAPPED_MODIFIED_MAGIC:
affdba
@@ -133,7 +133,7 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info)
affdba
 		   or ss991029 libpcap. */
affdba
 		byte_swapped = TRUE;
affdba
 		modified = TRUE;
affdba
-		wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+		wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 		break;
affdba
 
affdba
 	case PCAP_NSEC_MAGIC:
affdba
@@ -142,7 +142,7 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info)
affdba
 		   except that the time stamps have nanosecond resolution. */
affdba
 		byte_swapped = FALSE;
affdba
 		modified = FALSE;
affdba
-		wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+		wth->file_tsprec = WTAP_TSPREC_NSEC;
affdba
 		break;
affdba
 
affdba
 	case PCAP_SWAPPED_NSEC_MAGIC:
affdba
@@ -152,7 +152,7 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info)
affdba
 		   nanosecond resolution. */
affdba
 		byte_swapped = TRUE;
affdba
 		modified = FALSE;
affdba
-		wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+		wth->file_tsprec = WTAP_TSPREC_NSEC;
affdba
 		break;
affdba
 
affdba
 	default:
affdba
@@ -311,7 +311,7 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info)
affdba
 		 * precision to nanosecond precision.
affdba
 		 */
affdba
 		wth->file_type = WTAP_FILE_PCAP_AIX;
affdba
-		wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+		wth->file_tsprec = WTAP_TSPREC_NSEC;
affdba
 		return 1;
affdba
 	}
affdba
 
affdba
@@ -400,7 +400,7 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info)
affdba
 		 *
affdba
 		 * Try the standard format first.
affdba
 		 */
affdba
-		if(wth->tsprecision == WTAP_FILE_TSPREC_NSEC) {
affdba
+		if(wth->file_tsprec == WTAP_TSPREC_NSEC) {
affdba
 			wth->file_type = WTAP_FILE_PCAP_NSEC;
affdba
 		} else {
affdba
 			wth->file_type = WTAP_FILE_PCAP;
affdba
@@ -662,7 +662,7 @@ static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info,
affdba
 	/* Update the Timestamp, if not already done */
affdba
 	if (wth->file_encap != WTAP_ENCAP_ERF) {
affdba
 	  wth->phdr.ts.secs = hdr.hdr.ts_sec;
affdba
-	  if(wth->tsprecision == WTAP_FILE_TSPREC_NSEC) {
affdba
+	  if(wth->file_tsprec == WTAP_TSPREC_NSEC) {
affdba
 	    wth->phdr.ts.nsecs = hdr.hdr.ts_usec;
affdba
 	  } else {
affdba
 	    wth->phdr.ts.nsecs = hdr.hdr.ts_usec * 1000;
affdba
@@ -901,18 +901,18 @@ gboolean libpcap_dump_open(wtap_dumper *wdh, int *err)
affdba
 	case WTAP_FILE_PCAP_SS990417:	/* modified, but with the old magic, sigh */
affdba
 	case WTAP_FILE_PCAP_NOKIA:	/* Nokia libpcap of some sort */
affdba
 		magic = PCAP_MAGIC;
affdba
-		wdh->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+		wdh->tsprecision = WTAP_TSPREC_USEC;
affdba
 		break;
affdba
 
affdba
 	case WTAP_FILE_PCAP_SS990915:	/* new magic, extra crap */
affdba
 	case WTAP_FILE_PCAP_SS991029:
affdba
 		magic = PCAP_MODIFIED_MAGIC;
affdba
-		wdh->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+		wdh->tsprecision = WTAP_TSPREC_USEC;
affdba
 		break;
affdba
 
affdba
 	case WTAP_FILE_PCAP_NSEC:		/* same as WTAP_FILE_PCAP, but nsec precision */
affdba
 		magic = PCAP_NSEC_MAGIC;
affdba
-		wdh->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+		wdh->tsprecision = WTAP_TSPREC_NSEC;
affdba
 		break;
affdba
 
affdba
 	default:
affdba
@@ -966,7 +966,7 @@ static gboolean libpcap_dump(wtap_dumper *wdh,
affdba
 	phdrsize = pcap_get_phdr_size(wdh->encap, pseudo_header);
affdba
 
affdba
 	rec_hdr.hdr.ts_sec = (guint32) phdr->ts.secs;
affdba
-	if(wdh->tsprecision == WTAP_FILE_TSPREC_NSEC) {
affdba
+	if(wdh->tsprecision == WTAP_TSPREC_NSEC) {
affdba
 		rec_hdr.hdr.ts_usec = phdr->ts.nsecs;
affdba
 	} else {
affdba
 		rec_hdr.hdr.ts_usec = phdr->ts.nsecs / 1000;
affdba
diff --git a/wiretap/mime_file.c b/wiretap/mime_file.c
affdba
index 6c64d0e..d0aae88 100644
affdba
--- a/wiretap/mime_file.c
affdba
+++ b/wiretap/mime_file.c
affdba
@@ -190,7 +190,7 @@ mime_file_open(wtap *wth, int *err, gchar **err_info)
affdba
 
affdba
 	wth->file_type = WTAP_FILE_MIME;
affdba
 	wth->file_encap = WTAP_ENCAP_MIME;
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_SEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_SEC;
affdba
 	wth->subtype_read = mime_read;
affdba
 	wth->subtype_seek_read = mime_seek_read;
affdba
 	wth->snapshot_length = 0;
affdba
diff --git a/wiretap/mp2t.c b/wiretap/mp2t.c
affdba
index 8496437..de057ba 100644
affdba
--- a/wiretap/mp2t.c
affdba
+++ b/wiretap/mp2t.c
affdba
@@ -220,7 +220,7 @@ mp2t_open(wtap *wth, int *err, gchar **err_info)
affdba
 
affdba
     wth->file_type = WTAP_FILE_MPEG_2_TS;
affdba
     wth->file_encap = WTAP_ENCAP_MPEG_2_TS;
affdba
-    wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+    wth->file_tsprec = WTAP_TSPREC_NSEC;
affdba
     wth->subtype_read = mp2t_read;
affdba
     wth->subtype_seek_read = mp2t_seek_read;
affdba
     wth->snapshot_length = 0;
affdba
diff --git a/wiretap/mpeg.c b/wiretap/mpeg.c
affdba
index 5c6710f..4545ffb 100644
affdba
--- a/wiretap/mpeg.c
affdba
+++ b/wiretap/mpeg.c
affdba
@@ -299,7 +299,7 @@ good_magic:
affdba
 
affdba
 	wth->file_type = WTAP_FILE_MPEG;
affdba
 	wth->file_encap = WTAP_ENCAP_MPEG;
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_NSEC;
affdba
 	wth->subtype_read = mpeg_read;
affdba
 	wth->subtype_seek_read = mpeg_seek_read;
affdba
 	wth->snapshot_length = 0;
affdba
diff --git a/wiretap/netmon.c b/wiretap/netmon.c
affdba
index e53bdfc..3b3ed46 100644
affdba
--- a/wiretap/netmon.c
affdba
+++ b/wiretap/netmon.c
affdba
@@ -402,7 +402,7 @@ int netmon_open(wtap *wth, int *err, gchar **err_info)
affdba
 		 * Version 1.x of the file format supports
affdba
 		 * millisecond precision.
affdba
 		 */
affdba
-		wth->tsprecision = WTAP_FILE_TSPREC_MSEC;
affdba
+		wth->file_tsprec = WTAP_TSPREC_MSEC;
affdba
 		break;
affdba
 
affdba
 	case 2:
affdba
@@ -412,7 +412,7 @@ int netmon_open(wtap *wth, int *err, gchar **err_info)
affdba
 		 * currently support that, so say
affdba
 		 * "nanosecond precision" for now.
affdba
 		 */
affdba
-		wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+		wth->file_tsprec = WTAP_TSPREC_NSEC;
affdba
 		break;
affdba
 	}
affdba
 	return 1;
affdba
diff --git a/wiretap/netscaler.c b/wiretap/netscaler.c
affdba
index ba1126c..617b17b 100644
affdba
--- a/wiretap/netscaler.c
affdba
+++ b/wiretap/netscaler.c
affdba
@@ -651,7 +651,7 @@ int nstrace_open(wtap *wth, int *err, gchar **err_info)
affdba
         nstrace->nstrace_buf_offset = 0;
affdba
     }
affdba
 
affdba
-    wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+    wth->file_tsprec = WTAP_TSPREC_NSEC;
affdba
     wth->phdr.ts.secs = nstrace->nspm_curtime;
affdba
     wth->phdr.ts.nsecs = 0;
affdba
 
affdba
diff --git a/wiretap/netscreen.c b/wiretap/netscreen.c
affdba
index ad218af..a029dd6 100644
affdba
--- a/wiretap/netscreen.c
affdba
+++ b/wiretap/netscreen.c
affdba
@@ -184,7 +184,7 @@ int netscreen_open(wtap *wth, int *err, gchar **err_info)
affdba
 	wth->snapshot_length = 0; /* not known */
affdba
 	wth->subtype_read = netscreen_read;
affdba
 	wth->subtype_seek_read = netscreen_seek_read;
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_DSEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_DSEC;
affdba
 	
affdba
 	return 1;
affdba
 }
affdba
diff --git a/wiretap/nettl.c b/wiretap/nettl.c
affdba
index 757ddaa..d881eeb 100644
affdba
--- a/wiretap/nettl.c
affdba
+++ b/wiretap/nettl.c
affdba
@@ -287,7 +287,7 @@ int nettl_open(wtap *wth, int *err, gchar **err_info)
affdba
     if (file_seek(wth->fh, FILE_HDR_SIZE, SEEK_SET, err) == -1) {
affdba
 	return -1;
affdba
     }
affdba
-    wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+    wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 
affdba
     return 1;
affdba
 }
affdba
diff --git a/wiretap/network_instruments.c b/wiretap/network_instruments.c
affdba
index 3640d28..9ba7100 100644
affdba
--- a/wiretap/network_instruments.c
affdba
+++ b/wiretap/network_instruments.c
affdba
@@ -247,7 +247,7 @@ int network_instruments_open(wtap *wth, int *err, gchar **err_info)
affdba
     wth->subtype_close = NULL;
affdba
     wth->subtype_sequential_close = NULL;
affdba
     wth->snapshot_length = 0;    /* not available in header */
affdba
-    wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+    wth->file_tsprec = WTAP_TSPREC_NSEC;
affdba
     wth->file_type = WTAP_FILE_NETWORK_INSTRUMENTS;
affdba
 
affdba
     /* reset the pointer to the first packet */
affdba
diff --git a/wiretap/netxray.c b/wiretap/netxray.c
affdba
index c2af737..d4d2710 100644
affdba
--- a/wiretap/netxray.c
affdba
+++ b/wiretap/netxray.c
affdba
@@ -495,12 +495,12 @@ int netxray_open(wtap *wth, int *err, gchar **err_info)
affdba
 
affdba
 	case WTAP_FILE_NETXRAY_OLD:
affdba
 		ticks_per_sec = 1000.0;
affdba
-		wth->tsprecision = WTAP_FILE_TSPREC_MSEC;
affdba
+		wth->file_tsprec = WTAP_TSPREC_MSEC;
affdba
 		break;
affdba
 
affdba
 	case WTAP_FILE_NETXRAY_1_0:
affdba
 		ticks_per_sec = 1000.0;
affdba
-		wth->tsprecision = WTAP_FILE_TSPREC_MSEC;
affdba
+		wth->file_tsprec = WTAP_TSPREC_MSEC;
affdba
 		break;
affdba
 
affdba
 	case WTAP_FILE_NETXRAY_1_1:
affdba
@@ -511,7 +511,7 @@ int netxray_open(wtap *wth, int *err, gchar **err_info)
affdba
 		 * and older versions of Windows Sniffer.
affdba
 		 */
affdba
 		ticks_per_sec = 1000000.0;
affdba
-		wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+		wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 		break;
affdba
 
affdba
 	case WTAP_FILE_NETXRAY_2_00x:
affdba
@@ -668,9 +668,9 @@ int netxray_open(wtap *wth, int *err, gchar **err_info)
affdba
 		 * XXX - Seems reasonable to use nanosecs only if TPS >= 10M
affdba
 		 */
affdba
 		if (ticks_per_sec >= 1e7)
affdba
-			wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+			wth->file_tsprec = WTAP_TSPREC_NSEC;
affdba
 		else
affdba
-			wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+			wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 		break;
affdba
 
affdba
 	default:
affdba
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c
affdba
index f15694f..4ada82d 100644
affdba
--- a/wiretap/ngsniffer.c
affdba
+++ b/wiretap/ngsniffer.c
affdba
@@ -799,7 +799,7 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info)
affdba
 	 * isn't stored in the capture file.
affdba
 	 */
affdba
 
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_NSEC;	/* XXX */
affdba
+	wth->file_tsprec = WTAP_TSPREC_NSEC;	/* XXX */
affdba
 
affdba
 	return 1;
affdba
 }
affdba
diff --git a/wiretap/packetlogger.c b/wiretap/packetlogger.c
affdba
index eece1a0..fcaedc9 100644
affdba
--- a/wiretap/packetlogger.c
affdba
+++ b/wiretap/packetlogger.c
affdba
@@ -118,7 +118,7 @@ int packetlogger_open(wtap *wth, int *err, gchar **err_info)
affdba
 
affdba
 	wth->file_type = WTAP_FILE_PACKETLOGGER;
affdba
 	wth->file_encap = WTAP_ENCAP_PACKETLOGGER;
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 
affdba
 	return 1; /* Our kind of file */
affdba
 }
affdba
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c
affdba
index f652057..338be96 100644
affdba
--- a/wiretap/pcapng.c
affdba
+++ b/wiretap/pcapng.c
affdba
@@ -371,7 +371,6 @@ typedef struct wtapng_block_s {
affdba
         const union wtap_pseudo_header *pseudo_header;
affdba
         struct wtap_pkthdr *packet_header;
affdba
         const guint8 *frame_buffer;
affdba
-        int *file_encap;
affdba
 } wtapng_block_t;
affdba
 
affdba
 /* Interface data in private struct */
affdba
@@ -379,6 +378,7 @@ typedef struct interface_data_s {
affdba
         int wtap_encap;
affdba
         guint32 snap_len;
affdba
         guint64 time_units_per_second;
affdba
+        int tsprecision;
affdba
 } interface_data_t;
affdba
 
affdba
 typedef struct {
affdba
@@ -643,10 +643,12 @@ pcapng_read_section_header_block(FILE_T fh, gboolean first_block,
affdba
 
affdba
 /* "Interface Description Block" */
affdba
 static int
affdba
-pcapng_read_if_descr_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn,
affdba
-                           wtapng_block_t *wblock, int *err, gchar **err_info)
affdba
+pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh,
affdba
+                           pcapng_t *pn, wtapng_block_t *wblock, int *err,
affdba
+                           gchar **err_info)
affdba
 {
affdba
-        guint64 time_units_per_second = 1000000; /* default */
affdba
+        guint64 time_units_per_second = 1000000; /* default = 10^6 */
affdba
+        int     tsprecision = WTAP_TSPREC_USEC;
affdba
         int     bytes_read;
affdba
         int     block_read;
affdba
         int to_read, opt_cont_buf_len;
affdba
@@ -690,6 +692,7 @@ pcapng_read_if_descr_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn,
affdba
 
affdba
         wblock->data.if_descr.wtap_encap = wtap_pcap_encap_to_wtap_encap(wblock->data.if_descr.link_type);
affdba
         wblock->data.if_descr.time_units_per_second = time_units_per_second;
affdba
+        wblock->data.if_descr.tsprecision = tsprecision;
affdba
 
affdba
         pcapng_debug3("pcapng_read_if_descr_block: IDB link_type %u (%s), snap %u",
affdba
                       wblock->data.if_descr.link_type,
affdba
@@ -821,7 +824,20 @@ pcapng_read_if_descr_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn,
affdba
                                 }
affdba
                                 wblock->data.if_descr.time_units_per_second = time_units_per_second;
affdba
                                 wblock->data.if_descr.if_tsresol = if_tsresol;
affdba
-                                pcapng_debug2("pcapng_read_if_descr_block: if_tsresol %u, units/s %" G_GINT64_MODIFIER "u", wblock->data.if_descr.if_tsresol, wblock->data.if_descr.time_units_per_second);
affdba
+                                if (time_units_per_second >= 1000000000)
affdba
+                                    tsprecision = WTAP_TSPREC_NSEC;
affdba
+                                else if (time_units_per_second >= 1000000)
affdba
+                                    tsprecision = WTAP_TSPREC_USEC;
affdba
+                                else if (time_units_per_second >= 1000)
affdba
+                                    tsprecision = WTAP_TSPREC_MSEC;
affdba
+                                else if (time_units_per_second >= 100)
affdba
+                                    tsprecision = WTAP_TSPREC_CSEC;
affdba
+                                else if (time_units_per_second >= 10)
affdba
+                                    tsprecision = WTAP_TSPREC_DSEC;
affdba
+                                else
affdba
+                                    tsprecision = WTAP_TSPREC_SEC;
affdba
+                                wblock->data.if_descr.tsprecision = tsprecision;
affdba
+                                pcapng_debug3("pcapng_read_if_descr_block: if_tsresol %u, units/s %" G_GINT64_MODIFIER "u, tsprecision %d", wblock->data.if_descr.if_tsresol, wblock->data.if_descr.time_units_per_second, tsprecision);
affdba
                         } else {
affdba
                                 pcapng_debug1("pcapng_read_if_descr_block: if_tsresol length %u not 1 as expected", oh.option_length);
affdba
                         }
affdba
@@ -883,12 +899,33 @@ pcapng_read_if_descr_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn,
affdba
 
affdba
         g_free(option_content);
affdba
 
affdba
-        if (*wblock->file_encap == WTAP_ENCAP_UNKNOWN) {
affdba
-                *wblock->file_encap = wblock->data.if_descr.wtap_encap;
affdba
+        /*
affdba
+         * If the per-file encapsulation isn't known, set it to this
affdba
+         * interface's encapsulation.
affdba
+         *
affdba
+         * If it *is* known, and it isn't this interface's encapsulation,
affdba
+         * set it to WTAP_ENCAP_PER_PACKET, as this file doesn't
affdba
+         * have a single encapsulation for all interfaces in the file,
affdba
+         * so it probably doesn't have a single encapsulation for all
affdba
+         * packets in the file.
affdba
+         */
affdba
+        if (wth->file_encap == WTAP_ENCAP_UNKNOWN) {
affdba
+            wth->file_encap = wblock->data.if_descr.wtap_encap;
affdba
         } else {
affdba
-                if (*wblock->file_encap != wblock->data.if_descr.wtap_encap) {
affdba
-                        *wblock->file_encap = WTAP_ENCAP_PER_PACKET;
affdba
-                }
affdba
+            if (wth->file_encap != wblock->data.if_descr.wtap_encap) {
affdba
+                wth->file_encap = WTAP_ENCAP_PER_PACKET;
affdba
+            }
affdba
+        }
affdba
+
affdba
+        /*
affdba
+         * The same applies to the per-file time stamp resolution.
affdba
+         */
affdba
+        if (wth->file_tsprec == WTAP_TSPREC_UNKNOWN) {
affdba
+            wth->file_tsprec = wblock->data.if_descr.tsprecision;
affdba
+        } else {
affdba
+            if (wth->file_tsprec != wblock->data.if_descr.tsprecision) {
affdba
+                wth->file_tsprec = WTAP_TSPREC_PER_PACKET;
affdba
+            }
affdba
         }
affdba
 
affdba
         return block_read;
affdba
@@ -1065,6 +1102,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta
affdba
                        pcap_get_phdr_size(int_data.wtap_encap, wblock->pseudo_header));
affdba
         wblock->packet_header->interface_id = wblock->data.packet.interface_id;
affdba
         wblock->packet_header->pkt_encap = int_data.wtap_encap;
affdba
+        wblock->packet_header->pkt_tsprec = int_data.tsprecision;
affdba
 
affdba
         memset((void *)wblock->pseudo_header, 0, sizeof(union wtap_pseudo_header));
affdba
         pseudo_header_len = pcap_process_pseudo_header(fh,
affdba
@@ -1328,6 +1366,7 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *
affdba
         wblock->packet_header->presence_flags = WTAP_HAS_CAP_LEN|WTAP_HAS_INTERFACE_ID;
affdba
         wblock->packet_header->interface_id = 0;
affdba
         wblock->packet_header->pkt_encap = int_data.wtap_encap;
affdba
+        wblock->packet_header->pkt_tsprec = int_data.tsprecision;
affdba
         wblock->packet_header->ts.secs = 0;
affdba
         wblock->packet_header->ts.nsecs = 0;
affdba
         wblock->packet_header->interface_id = 0;
affdba
@@ -1905,7 +1944,7 @@ pcapng_read_unknown_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn _U_
affdba
 
affdba
 
affdba
 static int
affdba
-pcapng_read_block(FILE_T fh, gboolean first_block, pcapng_t *pn, wtapng_block_t *wblock, int *err, gchar **err_info)
affdba
+pcapng_read_block(wtap *wth, FILE_T fh, gboolean first_block, pcapng_t *pn, wtapng_block_t *wblock, int *err, gchar **err_info)
affdba
 {
affdba
         int block_read;
affdba
         int bytes_read;
affdba
@@ -1953,7 +1992,7 @@ pcapng_read_block(FILE_T fh, gboolean first_block, pcapng_t *pn, wtapng_block_t
affdba
                         bytes_read = pcapng_read_section_header_block(fh, first_block, &bh, pn, wblock, err, err_info);
affdba
                         break;
affdba
                 case(BLOCK_TYPE_IDB):
affdba
-                        bytes_read = pcapng_read_if_descr_block(fh, &bh, pn, wblock, err, err_info);
affdba
+                        bytes_read = pcapng_read_if_descr_block(wth, fh, &bh, pn, wblock, err, err_info);
affdba
                         break;
affdba
                 case(BLOCK_TYPE_PB):
affdba
                         bytes_read = pcapng_read_packet_block(fh, &bh, pn, wblock, err, err_info, FALSE);
affdba
@@ -2043,6 +2082,7 @@ pcapng_process_idb(wtap *wth, pcapng_t *pcapng, wtapng_block_t *wblock)
affdba
         interface_data.wtap_encap = wblock->data.if_descr.wtap_encap;
affdba
         interface_data.snap_len = wblock->data.if_descr.snap_len;
affdba
         interface_data.time_units_per_second = wblock->data.if_descr.time_units_per_second;
affdba
+        interface_data.tsprecision = wblock->data.if_descr.tsprecision;
affdba
 
affdba
         g_array_append_val(pcapng->interface_data, interface_data);
affdba
         pcapng->number_of_interfaces++;
affdba
@@ -2072,11 +2112,10 @@ pcapng_open(wtap *wth, int *err, gchar **err_info)
affdba
         wblock.frame_buffer = NULL;
affdba
         wblock.pseudo_header = NULL;
affdba
         wblock.packet_header = NULL;
affdba
-        wblock.file_encap = &wth->file_encap;
affdba
 
affdba
         pcapng_debug0("pcapng_open: opening file");
affdba
         /* read first block */
affdba
-        bytes_read = pcapng_read_block(wth->fh, TRUE, &pn, &wblock, err, err_info);
affdba
+        bytes_read = pcapng_read_block(wth, wth->fh, TRUE, &pn, &wblock, err, err_info);
affdba
         if (bytes_read <= 0) {
affdba
                 pcapng_debug0("pcapng_open: couldn't read first SHB");
affdba
                 *err = file_error(wth->fh, err_info);
affdba
@@ -2110,7 +2149,7 @@ pcapng_open(wtap *wth, int *err, gchar **err_info)
affdba
 
affdba
         wth->file_encap = WTAP_ENCAP_UNKNOWN;
affdba
         wth->snapshot_length = 0;
affdba
-        wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+        wth->file_tsprec = WTAP_TSPREC_NSEC;
affdba
         pcapng = (pcapng_t *)g_malloc(sizeof(pcapng_t));
affdba
         wth->priv = (void *)pcapng;
affdba
         *pcapng = pn;
affdba
@@ -2156,7 +2195,7 @@ pcapng_open(wtap *wth, int *err, gchar **err_info)
affdba
                 if (bh.block_type != BLOCK_TYPE_IDB) {
affdba
                         break;  /* No more IDB:s */
affdba
                 }
affdba
-                bytes_read = pcapng_read_block(wth->fh, FALSE, &pn, &wblock, err, err_info);
affdba
+                bytes_read = pcapng_read_block(wth, wth->fh, FALSE, &pn, &wblock, err, err_info);
affdba
                 if (bytes_read == 0) {
affdba
                         pcapng_debug0("No more IDBs available...");
affdba
                         break;
affdba
@@ -2200,14 +2239,13 @@ pcapng_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
affdba
         wblock.frame_buffer  = buffer_start_ptr(wth->frame_buffer);
affdba
         wblock.pseudo_header = &wth->phdr.pseudo_header;
affdba
         wblock.packet_header = &wth->phdr;
affdba
-        wblock.file_encap    = &wth->file_encap;
affdba
 
affdba
         pcapng->add_new_ipv4 = wth->add_new_ipv4;
affdba
         pcapng->add_new_ipv6 = wth->add_new_ipv6;
affdba
 
affdba
         /* read next block */
affdba
         while (1) {
affdba
-                bytes_read = pcapng_read_block(wth->fh, FALSE, pcapng, &wblock, err, err_info);
affdba
+                bytes_read = pcapng_read_block(wth, wth->fh, FALSE, pcapng, &wblock, err, err_info);
affdba
                 if (bytes_read <= 0) {
affdba
                         pcapng_debug1("pcapng_read: data_offset is finally %" G_GINT64_MODIFIER "d", *data_offset);
affdba
                         pcapng_debug0("pcapng_read: couldn't read packet block");
affdba
@@ -2219,6 +2257,7 @@ pcapng_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
affdba
                 case(BLOCK_TYPE_SHB):
affdba
                         /* We don't currently support multi-section files. */
affdba
                         wth->phdr.pkt_encap = WTAP_ENCAP_UNKNOWN;
affdba
+                        wth->phdr.pkt_tsprec = WTAP_TSPREC_UNKNOWN;
affdba
                         *err = WTAP_ERR_UNSUPPORTED;
affdba
                         *err_info = g_strdup_printf("pcapng: multi-section files not currently supported.");
affdba
                         return FALSE;
affdba
@@ -2332,10 +2371,9 @@ pcapng_seek_read(wtap *wth, gint64 seek_off,
affdba
         wblock.frame_buffer = pd;
affdba
         wblock.pseudo_header = pseudo_header;
affdba
         wblock.packet_header = &wth->phdr;
affdba
-        wblock.file_encap = &wth->file_encap;
affdba
 
affdba
         /* read the block */
affdba
-        bytes_read = pcapng_read_block(wth->random_fh, FALSE, pcapng, &wblock, err, err_info);
affdba
+        bytes_read = pcapng_read_block(wth, wth->random_fh, FALSE, pcapng, &wblock, err, err_info);
affdba
         if (bytes_read <= 0) {
affdba
                 *err = file_error(wth->random_fh, err_info);
affdba
                 pcapng_debug3("pcapng_seek_read: couldn't read packet block (err=%d, errno=%d, bytes_read=%d).",
affdba
diff --git a/wiretap/peekclassic.c b/wiretap/peekclassic.c
affdba
index e8b890e..8437d34 100644
affdba
--- a/wiretap/peekclassic.c
affdba
+++ b/wiretap/peekclassic.c
affdba
@@ -354,7 +354,7 @@ peekclassic_open(wtap *wth, int *err, gchar **err_info)
affdba
 	}
affdba
 
affdba
 	wth->snapshot_length   = 0; /* not available in header */
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 
affdba
 	return 1;
affdba
 }
affdba
diff --git a/wiretap/peektagged.c b/wiretap/peektagged.c
affdba
index 7f178ae..712ea88 100644
affdba
--- a/wiretap/peektagged.c
affdba
+++ b/wiretap/peektagged.c
affdba
@@ -338,7 +338,7 @@ int peektagged_open(wtap *wth, int *err, gchar **err_info)
affdba
     wth->file_encap = file_encap;
affdba
     wth->subtype_read = peektagged_read;
affdba
     wth->subtype_seek_read = peektagged_seek_read;
affdba
-    wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
affdba
+    wth->file_tsprec = WTAP_TSPREC_NSEC;
affdba
 
affdba
     peektagged = (peektagged_t *)g_malloc(sizeof(peektagged_t));
affdba
     wth->priv = (void *)peektagged;
affdba
diff --git a/wiretap/pppdump.c b/wiretap/pppdump.c
affdba
index 239f1a8..e3d4165 100644
affdba
--- a/wiretap/pppdump.c
affdba
+++ b/wiretap/pppdump.c
affdba
@@ -301,7 +301,7 @@ pppdump_open(wtap *wth, int *err, gchar **err_info)
affdba
 	wth->subtype_read = pppdump_read;
affdba
 	wth->subtype_seek_read = pppdump_seek_read;
affdba
 	wth->subtype_close = pppdump_close;
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_DSEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_DSEC;
affdba
 
affdba
 	state->seek_state = g_new(pppdump_t,1);
affdba
 
affdba
diff --git a/wiretap/radcom.c b/wiretap/radcom.c
affdba
index 8e9b701..719d904 100644
affdba
--- a/wiretap/radcom.c
affdba
+++ b/wiretap/radcom.c
affdba
@@ -167,7 +167,7 @@ int radcom_open(wtap *wth, int *err, gchar **err_info)
affdba
 	wth->subtype_read = radcom_read;
affdba
 	wth->subtype_seek_read = radcom_seek_read;
affdba
 	wth->snapshot_length = 0; /* not available in header, only in frame */
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 
affdba
 #if 0
affdba
 	tm.tm_year = pletohs(&start_date.year)-1900;
affdba
diff --git a/wiretap/snoop.c b/wiretap/snoop.c
affdba
index d2f765b..2da076d 100644
affdba
--- a/wiretap/snoop.c
affdba
+++ b/wiretap/snoop.c
affdba
@@ -433,7 +433,7 @@ int snoop_open(wtap *wth, int *err, gchar **err_info)
affdba
 	wth->subtype_seek_read = snoop_seek_read;
affdba
 	wth->file_encap = file_encap;
affdba
 	wth->snapshot_length = 0;	/* not available in header */
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 	return 1;
affdba
 }
affdba
 
affdba
diff --git a/wiretap/tnef.c b/wiretap/tnef.c
affdba
index 3afd1d4..f352c24 100644
affdba
--- a/wiretap/tnef.c
affdba
+++ b/wiretap/tnef.c
affdba
@@ -128,7 +128,7 @@ int tnef_open(wtap *wth, int *err, gchar **err_info)
affdba
 
affdba
   wth->subtype_read = tnef_read;
affdba
   wth->subtype_seek_read = tnef_seek_read;
affdba
-  wth->tsprecision = WTAP_FILE_TSPREC_SEC;
affdba
+  wth->file_tsprec = WTAP_TSPREC_SEC;
affdba
 
affdba
   return 1;
affdba
 }
affdba
diff --git a/wiretap/toshiba.c b/wiretap/toshiba.c
affdba
index 07f00eb..f88474d 100644
affdba
--- a/wiretap/toshiba.c
affdba
+++ b/wiretap/toshiba.c
affdba
@@ -213,7 +213,7 @@ int toshiba_open(wtap *wth, int *err, gchar **err_info)
affdba
 	wth->snapshot_length = 0; /* not known */
affdba
 	wth->subtype_read = toshiba_read;
affdba
 	wth->subtype_seek_read = toshiba_seek_read;
affdba
-	wth->tsprecision = WTAP_FILE_TSPREC_CSEC;
affdba
+	wth->file_tsprec = WTAP_TSPREC_CSEC;
affdba
 
affdba
 	return 1;
affdba
 }
affdba
diff --git a/wiretap/visual.c b/wiretap/visual.c
affdba
index 59400ba..a0f9852 100644
affdba
--- a/wiretap/visual.c
affdba
+++ b/wiretap/visual.c
affdba
@@ -267,7 +267,7 @@ int visual_open(wtap *wth, int *err, gchar **err_info)
affdba
     /* Set up the pointers to the handlers for this file type */
affdba
     wth->subtype_read = visual_read;
affdba
     wth->subtype_seek_read = visual_seek_read;
affdba
-    wth->tsprecision = WTAP_FILE_TSPREC_MSEC;
affdba
+    wth->file_tsprec = WTAP_TSPREC_MSEC;
affdba
 
affdba
     /* Add Visual-specific information to the wiretap struct for later use. */
affdba
     visual = (struct visual_read_info *)g_malloc(sizeof(struct visual_read_info));
affdba
diff --git a/wiretap/vms.c b/wiretap/vms.c
affdba
index f5c440b..550a5ac 100644
affdba
--- a/wiretap/vms.c
affdba
+++ b/wiretap/vms.c
affdba
@@ -253,7 +253,7 @@ int vms_open(wtap *wth, int *err, gchar **err_info)
affdba
     wth->snapshot_length = 0; /* not known */
affdba
     wth->subtype_read = vms_read;
affdba
     wth->subtype_seek_read = vms_seek_read;
affdba
-    wth->tsprecision = WTAP_FILE_TSPREC_CSEC;
affdba
+    wth->file_tsprec = WTAP_TSPREC_CSEC;
affdba
 
affdba
     return 1;
affdba
 }
affdba
diff --git a/wiretap/vwr.c b/wiretap/vwr.c
affdba
index 0f1dbc3..881ad64 100644
affdba
--- a/wiretap/vwr.c
affdba
+++ b/wiretap/vwr.c
affdba
@@ -653,7 +653,7 @@ int vwr_open(wtap *wth, int *err, gchar **err_info)
affdba
     wth->snapshot_length = 0;
affdba
     wth->subtype_read = vwr_read;
affdba
     wth->subtype_seek_read = vwr_seek_read;
affdba
-    wth->tsprecision = WTAP_FILE_TSPREC_USEC;
affdba
+    wth->file_tsprec = WTAP_TSPREC_USEC;
affdba
 
affdba
     if (fpgaVer == vVW510021_W_FPGA) {
affdba
         wth->file_type = WTAP_FILE_VWR_80211;
affdba
diff --git a/wiretap/wtap-int.h b/wiretap/wtap-int.h
affdba
index 1c17a42..15d5102 100644
affdba
--- a/wiretap/wtap-int.h
affdba
+++ b/wiretap/wtap-int.h
affdba
@@ -69,11 +69,19 @@ struct wtap {
affdba
     int                         file_encap;    /* per-file, for those
affdba
                                                 * file formats that have
affdba
                                                 * per-file encapsulation
affdba
-                                                * types
affdba
-                                                */
affdba
-    int                         tsprecision;   /* timestamp precision of the lower 32bits
affdba
-                                                * e.g. WTAP_FILE_TSPREC_USEC
affdba
+                                                * types rather than per-packet
affdba
+						* encapsulation types
affdba
                                                 */
affdba
+    int                         file_tsprec;   /* per-file timestamp precision
affdba
+                                                * of the fractional part of
affdba
+						* the time stamp, for those
affdba
+						* file formats that have
affdba
+						* per-file timestamp
affdba
+						* precision rather than
affdba
+						* per-packet timestamp
affdba
+						* precision
affdba
+						* e.g. WTAP_TSPREC_USEC
affdba
+						*/
affdba
     wtap_new_ipv4_callback_t    add_new_ipv4;
affdba
     wtap_new_ipv6_callback_t    add_new_ipv6;
affdba
     GPtrArray                   *fast_seek;
affdba
@@ -105,7 +113,7 @@ struct wtap_dumper {
affdba
     subtype_close_func      subtype_close;
affdba
 
affdba
     int                     tsprecision;    /**< timestamp precision of the lower 32bits
affdba
-                                             * e.g. WTAP_FILE_TSPREC_USEC
affdba
+                                             * e.g. WTAP_TSPREC_USEC
affdba
                                              */
affdba
     struct addrinfo         *addrinfo_list;
affdba
     struct wtapng_section_s *shb_hdr;
affdba
diff --git a/wiretap/wtap.c b/wiretap/wtap.c
affdba
index ee0cbc2..69803d6 100644
affdba
--- a/wiretap/wtap.c
affdba
+++ b/wiretap/wtap.c
affdba
@@ -95,9 +95,9 @@ wtap_file_encap(wtap *wth)
affdba
 }
affdba
 
affdba
 int
affdba
-wtap_file_tsprecision(wtap *wth)
affdba
+wtap_file_tsprec(wtap *wth)
affdba
 {
affdba
-	return wth->tsprecision;
affdba
+	return wth->file_tsprec;
affdba
 }
affdba
 
affdba
 wtapng_section_t *
affdba
@@ -862,6 +862,8 @@ wtap_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
affdba
 	 * capture file type doesn't have to set it), and if it
affdba
 	 * *is* WTAP_ENCAP_PER_PACKET, the caller needs to set it
affdba
 	 * anyway.
affdba
+         *
affdba
+         * Do the same for the packet time stamp resolution.
affdba
 	 */
affdba
 	wth->phdr.pkt_encap = wth->file_encap;
affdba
 
affdba
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
affdba
index 36674e9..b49c280 100644
affdba
--- a/wiretap/wtap.h
affdba
+++ b/wiretap/wtap.h
affdba
@@ -319,12 +319,14 @@ extern "C" {
affdba
 #define WTAP_NUM_FILE_TYPES                     wtap_get_num_file_types()
affdba
 
affdba
 /* timestamp precision (currently only these values are supported) */
affdba
-#define WTAP_FILE_TSPREC_SEC        0
affdba
-#define WTAP_FILE_TSPREC_DSEC       1
affdba
-#define WTAP_FILE_TSPREC_CSEC       2
affdba
-#define WTAP_FILE_TSPREC_MSEC       3
affdba
-#define WTAP_FILE_TSPREC_USEC       6
affdba
-#define WTAP_FILE_TSPREC_NSEC       9
affdba
+#define WTAP_TSPREC_UNKNOWN    -2
affdba
+#define WTAP_TSPREC_PER_PACKET -1
affdba
+#define WTAP_TSPREC_SEC         0
affdba
+#define WTAP_TSPREC_DSEC        1
affdba
+#define WTAP_TSPREC_CSEC        2
affdba
+#define WTAP_TSPREC_MSEC        3
affdba
+#define WTAP_TSPREC_USEC        6
affdba
+#define WTAP_TSPREC_NSEC        9
affdba
 
affdba
 /*
affdba
  * Maximum packet size we'll support.
affdba
@@ -866,7 +868,8 @@ struct wtap_pkthdr {
affdba
     struct wtap_nstime  ts;
affdba
     guint32             caplen;         /* data length in the file */
affdba
     guint32             len;            /* data length on the wire */
affdba
-    int                 pkt_encap;
affdba
+    int                 pkt_encap;      /* WTAP_ENCAP_ value for this packet */
affdba
+    int                 pkt_tsprec;     /* WTAP_TSPREC_ value for this packet */
affdba
                                         /* pcapng variables */
affdba
     guint32             interface_id;   /* identifier of the interface. */
affdba
                                         /* options */
affdba
@@ -1010,6 +1013,7 @@ typedef struct wtapng_iface_descriptions_s {
affdba
 typedef struct wtapng_if_descr_s {
affdba
     int                    wtap_encap;            /**< link_type translated to wtap_encap */
affdba
     guint64                time_units_per_second;
affdba
+    int                    tsprecision;           /**< WTAP_TSPREC_ value for this interface */
affdba
 
affdba
     /* mandatory */
affdba
     guint16                link_type;
affdba
@@ -1214,7 +1218,7 @@ int wtap_file_type(wtap *wth);
affdba
 WS_DLL_PUBLIC
affdba
 int wtap_file_encap(wtap *wth);
affdba
 WS_DLL_PUBLIC
affdba
-int wtap_file_tsprecision(wtap *wth);
affdba
+int wtap_file_tsprec(wtap *wth);
affdba
 WS_DLL_PUBLIC
affdba
 wtapng_section_t* wtap_file_get_shb_info(wtap *wth);
affdba
 WS_DLL_PUBLIC