security: Correct ValidityPeriod::isValid check
Change-Id: I235773470d838f5842cdf595f83d744935d304bd
Refs: #2868
diff --git a/src/security/validity-period.cpp b/src/security/validity-period.cpp
index c6f6026..14ba0f2 100644
--- a/src/security/validity-period.cpp
+++ b/src/security/validity-period.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -39,6 +39,12 @@
using boost::chrono::time_point_cast;
+ValidityPeriod::ValidityPeriod()
+ : ValidityPeriod(time::system_clock::TimePoint() + time::nanoseconds(1),
+ time::system_clock::TimePoint())
+{
+}
+
ValidityPeriod::ValidityPeriod(const time::system_clock::TimePoint& notBefore,
const time::system_clock::TimePoint& notAfter)
: m_notBefore(time_point_cast<TimePoint::duration>(notBefore + TimePoint::duration(1) -
@@ -144,7 +150,7 @@
bool
ValidityPeriod::isValid(const time::system_clock::TimePoint& now) const
{
- return m_notBefore < now && now < m_notAfter;
+ return m_notBefore <= now && now <= m_notAfter;
}
bool