amos 2f32624d3b Batch 18 (20261026-C-hwe-codegen-18): add 100 calibrated HWE code-gen tasks; pause production for rollout
100 tasks from the HWE arm-linux code-gen pool (outside the lk/man/pth
range given to batch 22), each with at least one independent
contract-edge defect and plain public docs. Claude reviewed 100/100
USABLE against current digests; no ID or source overlap with main or
batch 22. Difficulty is unmeasured.

progress.md records the wrap-up: all Codex sessions and Qwen schedulers
stopped for the user's rollout, Qwen results so far (57 HARD of 373),
and what is left on each batch branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 17:52:13 +08:00

62 lines
1.3 KiB
C++

#include "wait_station.hpp"
#include <limits>
namespace waitstation {
ClockBook::ClockBook()
: monotonic_(0), realtime_(0), initial_realtime_(0)
{
}
void ClockBook::reset(Integer monotonic, Integer realtime)
{
monotonic_ = monotonic;
realtime_ = realtime;
initial_realtime_ = realtime;
}
Code ClockBook::advance(Integer value)
{
if (value < 0) {
return RANGE;
}
if (value < monotonic_) {
return RANGE;
}
monotonic_ = value;
return OK;
}
void ClockBook::adjust(Integer value)
{
realtime_ = value;
}
Code ClockBook::read(Integer domain, Integer &value) const
{
if (domain == 0) {
value = monotonic_;
return OK;
}
if (domain == 1) {
value = realtime_;
return OK;
}
return RANGE;
}
bool ClockBook::expired(Integer domain, Integer deadline) const
{
if (domain == 0) {
return monotonic_ >= deadline;
}
return realtime_ >= deadline;
}
Integer ClockBook::remaining(Integer domain, Integer deadline) const
{
Integer current = 0;
read(domain, current);
if (deadline <= current) {
return 0;
}
const auto maximum = std::numeric_limits<Integer>::max();
if (current < 0 && deadline > maximum + current) {
return maximum;
}
return deadline - current;
}
}