Add a fourth choice of time format in the packet list display, which
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 1 Nov 2000 08:31:36 +0000 (08:31 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 1 Nov 2000 08:31:36 +0000 (08:31 +0000)
shows the date (in YYYY-MM-DD format) as well as the time of day when
the packet arrived.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@2547 f5534014-38df-0310-8fa8-9805f1628bb7

column.c
doc/ethereal.pod.template
doc/tethereal.pod.template
epan/packet.c
epan/packet.h
gtk/display_opts.c
gtk/main.c
tethereal.c
timestamp.h

index 1c802807aca66e05b8ac29dcead61f0d27d56fa3..07ff130380f8c160b1f2e3582cff0b47d2c0c8b5 100644 (file)
--- a/column.c
+++ b/column.c
@@ -1,7 +1,7 @@
 /* column.c
  * Routines for handling column preferences
  *
- * $Id: column.c,v 1.28 2000/08/11 13:34:48 deniel Exp $
+ * $Id: column.c,v 1.29 2000/11/01 08:31:33 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -52,8 +52,8 @@
    string */
 gchar *
 col_format_to_string(gint fmt) {
-  gchar *slist[] = { "%m", "%t", "%Rt", "%At", "%Tt", "%s", "%rs", "%us",
-                     "%hs", "%rhs", "%uhs", "%ns", "%rns", "%uns", "%d",
+  gchar *slist[] = { "%m", "%t", "%Rt", "%At", "%Yt", "%Tt", "%s", "%rs",
+                     "%us","%hs", "%rhs", "%uhs", "%ns", "%rns", "%uns", "%d",
                      "%rd", "%ud", "%hd", "%rhd", "%uhd", "%nd", "%rnd",
                      "%und", "%S", "%rS", "%uS", "%D", "%rD", "%uD", "%p",
                      "%i", "%L" };
@@ -69,7 +69,8 @@ col_format_to_string(gint fmt) {
 gchar *
 col_format_desc(gint fmt) {
   gchar *dlist[] = { "Number", "Time (command line specified)",
-                     "Relative time", "Absolute time", "Delta time",
+                     "Relative time", "Absolute time",
+                    "Absolute date and time", "Delta time",
                      "Source address", "Src addr (resolved)",
                      "Src addr (unresolved)", "Hardware src addr",
                      "Hw src addr (resolved)", "Hw src addr (unresolved)",
@@ -172,12 +173,17 @@ get_column_longest_string(gint format)
     case COL_CLS_TIME:
       if (timestamp_type == ABSOLUTE)
         return "00:00:00.000000";
+      else if (timestamp_type == ABSOLUTE_WITH_DATE)
+        return "0000-00-00 00:00:00.000000";
       else
         return "0000.000000";
       break;
     case COL_ABS_TIME:
       return "00:00:00.000000";
       break;
+    case COL_ABS_DATE_TIME:
+      return "0000-00-00 00:00:00.000000";
+      break;
     case COL_REL_TIME:
     case COL_DELTA_TIME:
       return "0000.000000";
@@ -236,6 +242,7 @@ get_column_resize_type(gint format) {
     case COL_NUMBER:
     case COL_CLS_TIME:
     case COL_ABS_TIME:
+    case COL_ABS_DATE_TIME:
     case COL_REL_TIME:
     case COL_DELTA_TIME:
     case COL_DEF_SRC_PORT:
@@ -284,10 +291,11 @@ get_column_resize_type(gint format) {
   }
 }
 
-#define TIME_DEF 0
-#define TIME_REL 1
-#define TIME_ABS 2
-#define TIME_DEL 3
+#define TIME_DEF      0
+#define TIME_REL      1
+#define TIME_ABS      2
+#define DATE_TIME_ABS 3
+#define TIME_DEL      4
 
 #define RES_DEF  0
 #define RES_DO   1
@@ -357,6 +365,9 @@ get_column_format_from_str(gchar *str) {
       case 'A':
         time_off = TIME_ABS;
         break;
+      case 'Y':
+        time_off = DATE_TIME_ABS;
+        break;
       case 'T':
         time_off = TIME_DEL;
         break;
index 0bad9777975a082072a1f8f6d0bb4ac06e79aea8..7142beff042f6dd6f0ee9899f2598cd135fa6dee 100644 (file)
@@ -177,11 +177,13 @@ Sets the initial height of the tree view (middle) pane.
 =item -t
 
 Sets the format of the packet timestamp displayed in the packet list
-window.  The format can be one of 'r' (relative), 'a' (absolute), or 'd'
-(delta).  The relative time is the time elapsed between the first packet
-and the current packet.  The absolute time is the actual date and time the
-packet was captured.  The delta time is the time since the previous packet
-was captured.  The default is relative.
+window.  The format can be one of 'r' (relative), 'a' (absolute), 'ad'
+(absolute with date), or 'd' (delta).  The relative time is the time
+elapsed between the first packet and the current packet.  The absolute
+time is the actual time the packet was captured, with no date displayed;
+the absolute date and time is the actual time and date the packet was
+captured.  The delta time is the time since the previous packet was
+captured.  The default is relative.
 
 =item -v
 
@@ -290,10 +292,10 @@ the capture packet statistics dialog box), stops the capture.
 =item Display:Options
 
 Allows you to sets the format of the packet timestamp displayed in the
-packet list window to relative, absolute, or delta, to enable or disable
-the automatic scrolling of the packet list while a live capture is in
-progress or to enable or disable translation of addresses to names in the
-display.
+packet list window to relative, absolute, absolute date and time, or
+delta, to enable or disable the automatic scrolling of the packet list
+while a live capture is in progress or to enable or disable translation
+of addresses to names in the display.
 
 =item Display:Match Selected
 
@@ -628,14 +630,15 @@ check box.
 
 =item Display Options
 
-The I<Display Options> dialog lets you specify the format of the time stamp
-in the packet list.  You can select "Time of day" for absolute time stamps,
-"Seconds since beginning of capture" for relative time stamps, or
+The I<Display Options> dialog lets you specify the format of the time
+stamp in the packet list.  You can select "Time of day" for absolute
+time stamps, "Date and time of day" for absolute time stamps with the
+date, "Seconds since beginning of capture" for relative time stamps, or
 "Seconds since previous frame" for delta time stamps.  You can also
 specify whether, when the display is updated as packets are captured,
 the list should automatically scroll to show the most recently captured
-packets or not and whether addresses should be translated to names in the
-display.
+packets or not and whether addresses should be translated to names in
+the display.
 
 =item Plugins
 
index 7906473309d294e00c5868aeaf33ea44b7d0eb3e..f683b07c38e2aae9ca25ee6ee4ff74ad69ca390a 100644 (file)
@@ -175,12 +175,14 @@ memory, or saved to disk.
 
 =item -t
 
-Sets the format of the packet timestamp printed in summary lines.
-The format can be one of 'r' (relative), 'a' (absolute), or 'd'
-(delta).  The relative time is the time elapsed between the first packet
-and the current packet.  The absolute time is the actual date and time the
-packet was captured.  The delta time is the time since the previous packet
-was captured.  The default is relative.
+Sets the format of the packet timestamp printed in summary lines.  The
+format can be one of 'r' (relative), 'a' (absolute), 'ad' (absolute with
+date), or 'd' (delta).  The relative time is the time elapsed between
+the first packet and the current packet.  The absolute time is the
+actual time the packet was captured, with no date displayed; the
+absolute date and time is the actual time and date the packet was
+captured.  The delta time is the time since the previous packet was
+captured.  The default is relative.
 
 =item -v
 
index c68de7ce61494a1fbf8894ca0958a02c9739d044..1a4f1d444b22487022e49eee4750d052eeba2a31 100644 (file)
@@ -1,7 +1,7 @@
 /* packet.c
  * Routines for packet disassembly
  *
- * $Id: packet.c,v 1.2 2000/10/06 10:11:15 gram Exp $
+ * $Id: packet.c,v 1.3 2000/11/01 08:31:35 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -663,6 +663,25 @@ col_set_abs_time(frame_data *fd, int col)
     (long)fd->abs_usecs/100);
 }
 
+static void
+col_set_abs_date_time(frame_data *fd, int col)
+{
+  struct tm *tmp;
+  time_t then;
+
+  then = fd->abs_secs;
+  tmp = localtime(&then);
+  snprintf(fd->cinfo->col_data[col], COL_MAX_LEN,
+    "%04d-%02d-%02d %02d:%02d:%02d.%04ld",
+    tmp->tm_year + 1900,
+    tmp->tm_mon + 1,
+    tmp->tm_mday,
+    tmp->tm_hour,
+    tmp->tm_min,
+    tmp->tm_sec,
+    (long)fd->abs_usecs/100);
+}
+
 static void
 col_set_rel_time(frame_data *fd, int col)
 {
@@ -692,6 +711,10 @@ col_set_cls_time(frame_data *fd, int col)
       col_set_abs_time(fd, col);
       break;
 
+    case ABSOLUTE_WITH_DATE:
+      col_set_abs_date_time(fd, col);
+      break;
+
     case RELATIVE:
       col_set_rel_time(fd, col);
       break;
@@ -830,6 +853,10 @@ fill_in_columns(frame_data *fd)
       col_set_abs_time(fd, i);
       break;
 
+    case COL_ABS_DATE_TIME:
+      col_set_abs_date_time(fd, i);
+      break;
+
     case COL_REL_TIME:
       col_set_rel_time(fd, i);
       break;
index b7df0f0d1b5f8ef915cf3861d02a803461520f60..047e603b1159dccd4f85246635093df83b1f7ce5 100644 (file)
@@ -1,7 +1,7 @@
 /* packet.h
  * Definitions for packet disassembly structures and routines
  *
- * $Id: packet.h,v 1.2 2000/10/06 10:11:17 gram Exp $
+ * $Id: packet.h,v 1.3 2000/11/01 08:31:35 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -338,6 +338,7 @@ enum {
   COL_CLS_TIME,       /* Command line-specified time (default relative) */
   COL_REL_TIME,       /* Relative time */
   COL_ABS_TIME,       /* Absolute time */
+  COL_ABS_DATE_TIME,  /* Absolute date and time */
   COL_DELTA_TIME,     /* Delta time */
   COL_DEF_SRC,        /* Source address */
   COL_RES_SRC,        /* Resolved source */
index b20a70fe7c977276509baf71def6b671019dc226..e75462d2760126c783748a689067e5da139d18bd 100644 (file)
@@ -1,7 +1,7 @@
 /* display_opts.c
  * Routines for packet display windows
  *
- * $Id: display_opts.c,v 1.17 2000/10/19 22:59:24 guy Exp $
+ * $Id: display_opts.c,v 1.18 2000/11/01 08:31:35 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -66,6 +66,7 @@ extern GtkWidget *packet_list;
 
 /* Display callback data keys */
 #define E_DISPLAY_TIME_ABS_KEY   "display_time_abs"
+#define E_DISPLAY_DATE_TIME_ABS_KEY "display_date_time_abs"
 #define E_DISPLAY_TIME_REL_KEY   "display_time_rel"
 #define E_DISPLAY_TIME_DELTA_KEY "display_time_delta"
 #define E_DISPLAY_AUTO_SCROLL_KEY "display_auto_scroll"
@@ -137,6 +138,16 @@ display_opt_cb(GtkWidget *w, gpointer d) {
   
   gtk_widget_show(button);
 
+  button = dlg_radio_button_new_with_label_with_mnemonic(
+               gtk_radio_button_group(GTK_RADIO_BUTTON(button)),
+               "_Date and time of day", accel_group);
+  gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button),
+               (timestamp_type == ABSOLUTE_WITH_DATE));
+  gtk_object_set_data(GTK_OBJECT(display_opt_w), E_DISPLAY_DATE_TIME_ABS_KEY,
+               button);
+  gtk_box_pack_start(GTK_BOX(main_vb), button, TRUE, TRUE, 0);
+  gtk_widget_show(button);
+
   button = dlg_radio_button_new_with_label_with_mnemonic(
                gtk_radio_button_group(GTK_RADIO_BUTTON(button)),
                "Seconds since _beginning of capture", accel_group);
@@ -236,6 +247,11 @@ get_display_options(GtkWidget *parent_w)
   if (GTK_TOGGLE_BUTTON (button)->active)
     timestamp_type = ABSOLUTE;
 
+  button = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w),
+                                              E_DISPLAY_DATE_TIME_ABS_KEY);
+  if (GTK_TOGGLE_BUTTON (button)->active)
+    timestamp_type = ABSOLUTE_WITH_DATE;
+
   button = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w),
                                               E_DISPLAY_TIME_REL_KEY);
   if (GTK_TOGGLE_BUTTON (button)->active)
index fbe3b9fc68be1df5adbe7538a309f064d9321bfe..45d27d5b684df135ef129e1961016cb60d0078e6 100644 (file)
@@ -1,6 +1,6 @@
 /* main.c
  *
- * $Id: main.c,v 1.162 2000/10/27 17:19:23 gram Exp $
+ * $Id: main.c,v 1.163 2000/11/01 08:31:36 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -1088,13 +1088,15 @@ main(int argc, char *argv[])
           timestamp_type = RELATIVE;
         else if (strcmp(optarg, "a") == 0)
           timestamp_type = ABSOLUTE;
+        else if (strcmp(optarg, "ad") == 0)
+          timestamp_type = ABSOLUTE_WITH_DATE;
         else if (strcmp(optarg, "d") == 0)
           timestamp_type = DELTA;
         else {
           fprintf(stderr, "ethereal: Invalid time stamp type \"%s\"\n",
             optarg);
           fprintf(stderr, "It must be \"r\" for relative, \"a\" for absolute,\n");
-          fprintf(stderr, "or \"d\" for delta.\n");
+          fprintf(stderr, "\"ad\" for absolute with date, or \"d\" for delta.\n");
           exit(1);
         }
         break;
index 9bf51c8329aa2d4a5671846c599fc0a3b7b45d25..bb69f82900ee94906bef11fef5c665649e524278 100644 (file)
@@ -1,6 +1,6 @@
 /* tethereal.c
  *
- * $Id: tethereal.c,v 1.53 2000/11/01 07:38:54 guy Exp $
+ * $Id: tethereal.c,v 1.54 2000/11/01 08:31:33 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -375,13 +375,15 @@ main(int argc, char *argv[])
           timestamp_type = RELATIVE;
         else if (strcmp(optarg, "a") == 0)
           timestamp_type = ABSOLUTE;
+        else if (strcmp(optarg, "ad") == 0)
+          timestamp_type = ABSOLUTE_WITH_DATE;
         else if (strcmp(optarg, "d") == 0)
           timestamp_type = DELTA;
         else {
           fprintf(stderr, "tethereal: Invalid time stamp type \"%s\"\n",
             optarg);
           fprintf(stderr, "It must be \"r\" for relative, \"a\" for absolute,\n");
-          fprintf(stderr, "or \"d\" for delta.\n");
+          fprintf(stderr, "\"ad\" for absolute with date, or \"d\" for delta.\n");
           exit(1);
         }
         break;
index 15c7f56b2fd2488548d111bb1cacf85ca9e88da5..261cb7fcf2e77ef4f34062f41b8a7ca706ce54be 100644 (file)
@@ -1,7 +1,7 @@
 /* timestamp.h
  * Defines for packet timestamps
  *
- * $Id: timestamp.h,v 1.2 1999/07/13 02:52:59 gram Exp $
+ * $Id: timestamp.h,v 1.3 2000/11/01 08:31:33 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -41,6 +41,7 @@
 typedef enum {
        RELATIVE,
        ABSOLUTE,
+       ABSOLUTE_WITH_DATE,
        DELTA
 } ts_type;