aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2017-12-16 14:15:28 -0800
committerMichael Mann <mmann78@netscape.net>2017-12-17 02:30:40 +0000
commit6a5e90f2d91892248f5f7defe1c610e00298d789 (patch)
treef12e93fe35f2c658fb133335d1e8980c93e4dc20 /dumpcap.c
parent18c42e1dca9631b336dd2a8b813aad782569f69a (diff)
Log output updates.
Add a Qt message handler that calls g_log. Add milliseconds to the g_log_message_handler timestamp. Change-Id: I5b1c1d902b6b05cd8daa01741b19d6c2048dfb9a Reviewed-on: https://code.wireshark.org/review/24865 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'dumpcap.c')
-rw-r--r--dumpcap.c53
1 files changed, 1 insertions, 52 deletions
diff --git a/dumpcap.c b/dumpcap.c
index 19287b9fe7..bebe9195ef 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -94,6 +94,7 @@
#include "wsutil/os_version_info.h"
#include "wsutil/str_util.h"
#include "wsutil/inet_addr.h"
+#include "wsutil/time_util.h"
#include "caputils/ws80211_utils.h"
@@ -424,58 +425,6 @@ static void report_cfilter_error(capture_options *capture_opts, guint i, const c
#define MSG_MAX_LENGTH 4096
-/* Copied from pcapio.c pcapng_write_interface_statistics_block()*/
-static guint64
-create_timestamp(void) {
- guint64 timestamp;
-#ifdef _WIN32
- FILETIME now;
-#else
- struct timeval now;
-#endif
-
-#ifdef _WIN32
- /*
- * Current time, represented as 100-nanosecond intervals since
- * January 1, 1601, 00:00:00 UTC.
- *
- * I think DWORD might be signed, so cast both parts of "now"
- * to guint32 so that the sign bit doesn't get treated specially.
- *
- * Windows 8 provides GetSystemTimePreciseAsFileTime which we
- * might want to use instead.
- */
- GetSystemTimeAsFileTime(&now);
- timestamp = (((guint64)(guint32)now.dwHighDateTime) << 32) +
- (guint32)now.dwLowDateTime;
-
- /*
- * Convert to same thing but as 1-microsecond, i.e. 1000-nanosecond,
- * intervals.
- */
- timestamp /= 10;
-
- /*
- * Subtract difference, in microseconds, between January 1, 1601
- * 00:00:00 UTC and January 1, 1970, 00:00:00 UTC.
- */
- timestamp -= G_GUINT64_CONSTANT(11644473600000000);
-#else
- /*
- * Current time, represented as seconds and microseconds since
- * January 1, 1970, 00:00:00 UTC.
- */
- gettimeofday(&now, NULL);
-
- /*
- * Convert to delta in microseconds.
- */
- timestamp = (guint64)(now.tv_sec) * 1000000 +
- (guint64)(now.tv_usec);
-#endif
- return timestamp;
-}
-
static void
print_usage(FILE *output)
{