dump: add -t option to suppress printing per-packet timestamp
Change-Id: I4e0e44c62451629428d2d065692a0cb497a9203a
diff --git a/tools/dump/main.cpp b/tools/dump/main.cpp
index ebec765..4f756e5 100644
--- a/tools/dump/main.cpp
+++ b/tools/dump/main.cpp
@@ -74,6 +74,7 @@
("filter,f", po::value<std::string>(&nameFilter),
"print packet only if name matches this regular expression")
("no-promiscuous-mode,p", po::bool_switch(), "do not put the interface into promiscuous mode")
+ ("no-timestamp,t", po::bool_switch(), "do not print a timestamp for each packet")
("verbose,v", po::bool_switch(&instance.wantVerbose),
"print more detailed information about each packet")
("version,V", "print program version and exit")
@@ -140,6 +141,7 @@
}
instance.wantPromisc = !vm["no-promiscuous-mode"].as<bool>();
+ instance.wantTimestamp = !vm["no-timestamp"].as<bool>();
try {
instance.run();
diff --git a/tools/dump/ndndump.cpp b/tools/dump/ndndump.cpp
index 4c43826..77743a8 100644
--- a/tools/dump/ndndump.cpp
+++ b/tools/dump/ndndump.cpp
@@ -158,7 +158,9 @@
}
std::ostringstream os;
- printTimestamp(os, pkthdr->ts);
+ if (wantTimestamp) {
+ printTimestamp(os, pkthdr->ts);
+ }
ssize_t payloadSize = pkthdr->len;
diff --git a/tools/dump/ndndump.hpp b/tools/dump/ndndump.hpp
index 4de7f57..3a78edc 100644
--- a/tools/dump/ndndump.hpp
+++ b/tools/dump/ndndump.hpp
@@ -88,6 +88,7 @@
std::string pcapFilter = getDefaultPcapFilter();
optional<std::regex> nameFilter;
bool wantPromisc = true;
+ bool wantTimestamp = true;
bool wantVerbose = false;
private: