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(); }
bool Complement(const Validity &other) { if (!IsValid() && other.IsValid()) { *this = other; return true; } else return false; }
/** * This function calculates the time difference of the two Validity objects * @param other The second Validity object * @return The time difference in seconds */ fixed GetTimeDifference(const Validity &other) const { assert(IsValid()); assert(other.IsValid()); return Export(last - other.last); }