int main(int argc, char **argv) { plan_tests(11); Validity v; v.Clear(); ok1(!v.IsValid()); v.Update(100); ok1(v.IsValid()); v.Expire(101, 5); ok1(v.IsValid()); v.Expire(105, 5); ok1(v.IsValid()); v.Expire(106, 5); ok1(!v.IsValid()); v.Update(100); ok1(v.Modified(Validity(99))); ok1(!v.Modified(Validity(100))); ok1(!v.Modified(Validity(101))); ok1(!v.Complement(Validity(1))); v.Clear(); ok1(!v.Complement(invalid())); ok1(v.Complement(Validity(1))); return exit_status(); }
void Expire(fixed clock) { new_traffic.Expire(clock, fixed(60)); for (unsigned i = list.size(); i-- > 0;) if (!list[i].Refresh(clock)) list.quick_remove(i); }
void Refresh(fixed Time) { available.Expire(Time, fixed(10)); if (!available) traffic.clear(); for (unsigned i = traffic.size(); i-- > 0;) if (!traffic[i].Refresh(Time)) traffic.quick_remove(i); NewTraffic = false; }
/** * Clear this object if its data has expired. * * @return true if the object is still valid */ bool Refresh(fixed Time) { valid.Expire(Time, fixed(2)); return valid; }