Ethereal-dev: [ethereal-dev] Small patch to ease printing timestamps

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Neulinger, Nathan R." <nneul@xxxxxxx>
Date: Mon, 18 Oct 1999 15:55:36 -0500
Yeah, I could probably just convert them to timevals in my code, but this
seems handier. One less thing that the dissector has to worry about.

I personally would rename the constants (since they aren't used much) to:

	FT_ABSOLUTE_TIMET
	FT_RELATIVE_TIMET
	FT_ABSOLUTE_TIMEVAL
	FT_RELATIVE_TIMEVAL

In the current form, this just adds FT_ABSOLUTE_TIMET and FT_RELATIVE_TIMET

-- Nathan

------------------------------------------------------------
Nathan Neulinger                       EMail:  nneul@xxxxxxx
University of Missouri - Rolla         Phone: (573) 341-4841
Computing Services                       Fax: (573) 341-4216

Index: proto.c
===================================================================
RCS file: /cvsroot/ethereal/proto.c,v
retrieving revision 1.45
diff -u -r1.45 proto.c
--- proto.c	1999/10/17 11:40:14	1.45
+++ proto.c	1999/10/18 20:45:07
@@ -483,6 +487,12 @@
 			memcpy(fi->value.ether, va_arg(ap, guint8*), 6);
 			break;
 
+		case FT_ABSOLUTE_TIMET:
+		case FT_RELATIVE_TIMET:
+			fi->value.time.tv_sec = va_arg(ap, guint32*);
+			fi->value.time.tv_usec = 0;
+			break;
+
 		case FT_ABSOLUTE_TIME:
 		case FT_RELATIVE_TIME:
 			memcpy(&fi->value.time, va_arg(ap, struct timeval*),
@@ -671,12 +681,14 @@
 				fi->value.floating);
 			break;
 
+		case FT_ABSOLUTE_TIMET:
 		case FT_ABSOLUTE_TIME:
 			snprintf(label_str, ITEM_LABEL_LENGTH,
 				"%s: %s", fi->hfinfo->name,
 				abs_time_to_str(&fi->value.time));
 			break;
 
+		case FT_RELATIVE_TIMET:
 		case FT_RELATIVE_TIME:
 			snprintf(label_str, ITEM_LABEL_LENGTH,
 				"%s: %s seconds", fi->hfinfo->name,
@@ -1148,6 +1160,8 @@
 		case FT_BOOLEAN:
 		case FT_STRING:
 		case FT_DOUBLE:
+		case FT_ABSOLUTE_TIMET:
+		case FT_RELATIVE_TIMET:
 		case FT_ABSOLUTE_TIME:
 		case FT_RELATIVE_TIME:
 			return 0;
Index: proto.h
===================================================================
RCS file: /cvsroot/ethereal/proto.h,v
retrieving revision 1.17
diff -u -r1.17 proto.h
--- proto.h	1999/10/12 06:20:24	1.17
+++ proto.h	1999/10/18 20:45:07
@@ -64,6 +64,8 @@
 	FT_INT24,
 	FT_INT32,
 	FT_DOUBLE,
+	FT_ABSOLUTE_TIMET,
+	FT_RELATIVE_TIMET,
 	FT_ABSOLUTE_TIME,
 	FT_RELATIVE_TIME,
 	FT_STRING,
cvs server: Diffing doc
cvs server: Diffing gtk
cvs server: Diffing image
cvs server: Diffing wiretap