uint32_t getStartOfWeek()
{
+ // coverity[store_truncated_time_t]
uint32_t now = time(nullptr);
now -= (now % (7*86400));
return now;
void setTime(time_t sec, uint32_t usec)
{
+ // coverity[store_truncated_time_t]
add_uint32(d_message, Field::timeSec, sec);
add_uint32(d_message, Field::timeUsec, usec);
}
dr.d_type = entry->d_qtype;
dr.d_class = QClass::IN;
dr.d_content = k;
- dr.d_ttl = static_cast<uint32_t>(entry->d_ttd); // XXX truncation
+ // coverity[store_truncated_time_t]
+ dr.d_ttl = static_cast<uint32_t>(entry->d_ttd);
dr.d_place = DNSResourceRecord::ANSWER;
res->push_back(std::move(dr));
}
}
if (ttl > 0 && SyncRes::s_refresh_ttlperc > 0) {
const uint32_t deadline = origTTL * SyncRes::s_refresh_ttlperc / 100;
+ // coverity[store_truncated_time_t]
const bool almostExpired = static_cast<uint32_t>(ttl) <= deadline;
if (almostExpired && qname != g_rootdnsname) {
if (refresh) {
const time_t ttl = d_ttd - now;
const uint32_t lockline = d_orig_ttl * percentage / 100;
// We know ttl is > 0 as d_ttd > now
+ // coverity[store_truncated_time_t]
const bool locked = static_cast<uint32_t>(ttl) > lockline;
if (locked) {
return false;