dump: add -t option to suppress printing per-packet timestamp

Change-Id: I4e0e44c62451629428d2d065692a0cb497a9203a
diff --git a/manpages/ndndump.rst b/manpages/ndndump.rst
index 51737bb..e219538 100644
--- a/manpages/ndndump.rst
+++ b/manpages/ndndump.rst
@@ -54,6 +54,10 @@
 
     Do not put the interface into promiscuous mode.
 
+.. option:: -t, --no-timestamp
+
+    Do not print a timestamp for each packet.
+
 .. option:: -v, --verbose
 
     Produce verbose output.
diff --git a/tests/dump/ndndump.t.cpp b/tests/dump/ndndump.t.cpp
index 7583f08..b3f255e 100644
--- a/tests/dump/ndndump.t.cpp
+++ b/tests/dump/ndndump.t.cpp
@@ -191,6 +191,17 @@
   BOOST_CHECK(output.is_equal(expected));
 }
 
+BOOST_AUTO_TEST_CASE(NoTimestamp)
+{
+  dump.wantTimestamp = false;
+
+  lp::Packet lpPacket;
+  this->receive(lpPacket);
+
+  const std::string expected = "Tunnel Type: EthernetFrame, NDNLPv2-IDLE\n";
+  BOOST_CHECK(output.is_equal(expected));
+}
+
 BOOST_AUTO_TEST_CASE(PcapTraceFile)
 {
   dump.inputFile = "tests/dump/nack.pcap";
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: