osquery-1/osquery/tables/utility/time.cpp

27 lines
494 B
C++
Raw Normal View History

// Copyright 2004-present Facebook. All Rights Reserved.
#include <ctime>
2014-11-25 20:30:29 +00:00
#include "osquery/tables.h"
namespace osquery {
namespace tables {
const int kNumCols = 1;
QueryData genTime() {
Row r;
time_t _time = time(0);
struct tm* now = localtime(&_time);
r["hour"] = INTEGER(now->tm_hour);
r["minutes"] = INTEGER(now->tm_min);
r["seconds"] = INTEGER(now->tm_sec);
QueryData results;
for (int i = 0; i < kNumCols; ++i) {
results.push_back(r);
}
return results;
}
}
}