Commit 3c4f43c0 authored by Michael Ott's avatar Michael Ott

Report time in local time by default, add -u switch for UTC time

parent 7118a5c5
......@@ -45,8 +45,8 @@ void usage(void)
if (isatty(fileno(stdin))) {
/* 0---------1---------2---------3---------4---------5---------6---------7--------- */
std::cout << "Usage:" << std::endl;
std::cout << " dcdbquery [-h <host>] [-r] [-l] <Sensor 1> [<Sensor 2> ...] [<Start> <End>]" << std::endl;
std::cout << " dcdbquery [-h <host>] [-r] [-l] -j <jobId> <Sensor 1> [<Sensor 2> ...]" << std::endl;
std::cout << " dcdbquery [-h <host>] [-r] [-l] [-u] <Sensor 1> [<Sensor 2> ...] [<Start> <End>]" << std::endl;
std::cout << " dcdbquery [-h <host>] [-r] [-l] [-u] -j <jobId> <Sensor 1> [<Sensor 2> ...]" << std::endl;
std::cout << std::endl;
std::cout << "Parameters:" << std::endl;
std::cout << " <jobId> a job to query sensors for" << std::endl;
......@@ -57,7 +57,8 @@ void usage(void)
std::cout << "Options:" << std::endl;
std::cout << " -h<host> Cassandra host [default: " << DEFAULT_CASSANDRAHOST << ":" << DEFAULT_CASSANDRAPORT << "]" << endl;
std::cout << " -r Report timestamps in numerical format" << std::endl;
std::cout << " -l Report times in local time (not UTC)" << std::endl;
std::cout << " -l Report times in local time (not UTC) [default]" << std::endl;
std::cout << " -u Report times in UTC time" << std::endl;
}
else {
std::cout << "Invalid request." << std::endl;
......@@ -119,7 +120,7 @@ int main(int argc, char * const argv[])
}
std::string jobId;
while ((ret=getopt(argcReal, argvReal, "+h:rlj:"))!=-1) {
while ((ret=getopt(argcReal, argvReal, "+h:rluj:"))!=-1) {
switch(ret) {
case 'h':
host = optarg;
......@@ -130,6 +131,9 @@ int main(int argc, char * const argv[])
case 'l':
myQuery->setLocalTimeEnabled(true);
break;
case 'u':
myQuery->setLocalTimeEnabled(false);
break;
case 'j':
jobId = optarg;
break;
......
......@@ -409,6 +409,6 @@ void DCDBQuery::dojobQuery(std::list<std::string> sensors, std::string jobId) {
DCDBQuery::DCDBQuery()
{
connection = nullptr;
useLocalTime = false;
useLocalTime = true;
useRawOutput = false;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment