namespace {
int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-inline bool
+bool
isLeap(const int y) {
return ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0);
}
namespace isc {
namespace util {
namespace {
-const size_t DATE_LEN = 14; // YYYYMMDDHHmmSS
+constexpr size_t DATE_LEN = 14; // YYYYMMDDHHmmSS
-inline uint64_t
+uint64_t
ull(const int c) {
return (static_cast<uint64_t>(c));
}
-inline void
+void
checkRange(const unsigned min, const unsigned max, const unsigned value, const string& valname) {
if ((value >= min) && (value <= max)) {
return;
return (getTimeFunction());
}
- struct timeval now;
+ struct timeval now{};
gettimeofday(&now, 0);
return (static_cast<int64_t>(now.tv_sec));
string
timeToText64(uint64_t value) {
- struct tm tm;
+ struct tm tm{};
unsigned int secs;
// We cannot rely on gmtime() because time_t may not be of 64 bit
///
/// @param time_txt
///
-/// @return
+/// @return Seconds since epoch corresponding to @c time_txt as uint_32
uint32_t
timeFromText32(const std::string& time_txt);
/// YYYY... form, an exception of class @c InvalidTime will be thrown.
///
/// @param value Seconds since epoch to be converted.
+///
/// @return Textual representation of @c value in the form of YYYYMMDDHHmmSS.
///
/// @throw InvalidTime The given time specifies on or after year 10,000.
/// 2^32-1 (the highest value in 32-bit unsigned integers) will be converted
/// to "21060207062815", instead of "19691231235959".
///
-/// @param value
+/// @param value Seconds since epoch to be converted.
///
-/// @return
+/// @return Textual representation of @c value in the form of YYYYMMDDHHmmSS.
std::string
timeToText32(uint32_t value);
///@}