chunks+peek+ping: use correct underlying type for time::milliseconds
Change-Id: I3f46f846401eccc0c11d3abcd1a5ebff89056f7d
diff --git a/tools/peek/ndnpoke/main.cpp b/tools/peek/ndnpoke/main.cpp
index 913b0a8..4e8713a 100644
--- a/tools/peek/ndnpoke/main.cpp
+++ b/tools/peek/ndnpoke/main.cpp
@@ -55,7 +55,7 @@
("help,h", "print help and exit")
("unsolicited,u", po::bool_switch(&options.wantUnsolicited),
"send the Data packet without waiting for an incoming Interest")
- ("timeout,w", po::value<time::milliseconds::rep>(), "set timeout (in milliseconds)")
+ ("timeout,w", po::value<time::milliseconds::rep>(), "execution timeout, in milliseconds")
("verbose,v", po::bool_switch(&options.isVerbose), "turn on verbose output")
("version,V", "print version and exit")
;
@@ -65,7 +65,7 @@
("final,F", po::bool_switch(&options.wantFinalBlockId),
"set FinalBlockId to the last component of the Data name")
("freshness,x", po::value<time::milliseconds::rep>()->default_value(options.freshnessPeriod.count()),
- "set FreshnessPeriod (in milliseconds)")
+ "set FreshnessPeriod, in milliseconds")
("identity,i", po::value<std::string>(), "use the specified identity for signing")
("digest,D", po::bool_switch(&wantDigestSha256),
"use DigestSha256 signing method instead of SignatureSha256WithRsa")
@@ -134,13 +134,10 @@
return 2;
}
- if (vm.count("freshness") > 0) {
- auto freshness = vm["freshness"].as<time::milliseconds::rep>();
- if (freshness < 0) {
- std::cerr << "ERROR: freshness cannot be negative" << std::endl;
- return 2;
- }
- options.freshnessPeriod = time::milliseconds(freshness);
+ options.freshnessPeriod = time::milliseconds(vm["freshness"].as<time::milliseconds::rep>());
+ if (options.freshnessPeriod < 0_ms) {
+ std::cerr << "ERROR: freshness cannot be negative" << std::endl;
+ return 2;
}
if (vm.count("identity") > 0) {
@@ -166,12 +163,11 @@
std::cerr << "ERROR: conflicting '--unsolicited' and '--timeout' options specified" << std::endl;
return 2;
}
- auto timeout = vm["timeout"].as<time::milliseconds::rep>();
- if (timeout < 0) {
+ options.timeout = time::milliseconds(vm["timeout"].as<time::milliseconds::rep>());
+ if (*options.timeout < 0_ms) {
std::cerr << "ERROR: timeout cannot be negative" << std::endl;
return 2;
}
- options.timeout = time::milliseconds(timeout);
}
try {