/// @brief Constructor.
///
- /// Sets the time of the last fetched audit entry to Jan 1st, 1970,
+ /// Sets the time of the last fetched audit entry to Jan 1st, 2000,
/// with id 0.
CBControlBase()
: last_audit_revision_time_(getInitialAuditRevisionTime()),
/// @brief Convenience method returning initial timestamp to set the
/// @c last_audit_revision_time_ to.
///
- /// @return Returns 1970-Jan-01 00:00:00 in local time.
+ /// @return Returns 2000-Jan-01 00:00:00 in local time.
static boost::posix_time::ptime getInitialAuditRevisionTime() {
static boost::posix_time::ptime
- initial_time(boost::gregorian::date(1970, boost::gregorian::Jan, 1));
+ initial_time(boost::gregorian::date(2000, boost::gregorian::Jan, 1));
return (initial_time);
}
#include <config_backend/base_config_backend_pool.h>
#include <process/cb_ctl_base.h>
#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/shared_ptr.hpp>
#include <gtest/gtest.h>
#include <map>
EXPECT_EQ(TEST_INSTANCE_ID, mgr.getInstanceId());
}
+// This test verifies that the initial audit revision time is set to
+// local time of 2000-01-01.
+TEST_F(CBControlBaseTest, getInitialAuditRevisionTime) {
+ auto initial_time = cb_ctl_.getInitialAuditRevisionTime();
+ ASSERT_FALSE(initial_time.is_not_a_date_time());
+ auto tm = boost::posix_time::to_tm(initial_time);
+ EXPECT_EQ(100, tm.tm_year);
+ EXPECT_EQ(0, tm.tm_mon);
+ EXPECT_EQ(0, tm.tm_yday);
+ EXPECT_EQ(0, tm.tm_hour);
+ EXPECT_EQ(0, tm.tm_min);
+ EXPECT_EQ(0, tm.tm_sec);
+}
+
// This test verifies that last audit entry time is reset upon the
// call to CBControlBase::reset().
TEST_F(CBControlBaseTest, reset) {