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