Ce qu’il fait
- Horloges monotone et murale, temps CPU, horloge manuelle pour les tests
- Arithmétique vérifiée qui renvoie une erreur au lieu de déborder
- Calendrier civil et semaine ISO
- RFC 3339 et RFC 7231, parsing strict ou tolérant
- Roue de timers à 4 niveaux
- Mise en veille hybride sans modifier la résolution du timer système
Mesuré
- Lecture de l'horloge monotone : 18.75 ns sous Windows x64 (MSVC) et 22.00 ns sous Linux x64 (GCC, WSL)
- Formatage RFC 3339 avec millisecondes : environ 20 ns. Parsing : environ 23 ns, sans allocation
- Roue avec un million de timers actifs : armement en 20 à 23 ns, annulation en 20 à 24 ns
Limites connues
- La roue couvre 49.7 jours. Fuseaux horaires uniquement via l'OS, sans tzdb
Duration, time point, clocks and the time-source seam.
The module is a leaf: it includes no header from any other module of the library. That is what makes it possible to measure time from inside any other module without creating a cycle.
#include <ethereal/cpp/time/time_inc.hpp>
using namespace Ethereal::Time;
int main()
{
const STimePoint Inicio = NowMonotonic();
FazAlgumaCoisa();
const SDuration Gasto = NowMonotonic() - Inicio;
std::printf( "took %lld us\n", (long long)Gasto.ToMicroseconds() );
// Checked arithmetic, for when the value comes from outside.
SDuration Total{};
if( AddChecked( Gasto, Milliseconds( 500 ), Total ) != ETimeError::eOk )
return 1;
return 0;
}---
What already exists
| Piece | File | Status |
|---|---|---|
ETimeError | time_common.hpp | ready |
SDuration | duration.hpp | ready |
| raw count conversion | tickscale.hpp | ready |
EClockKind, STimePoint | clock.hpp | ready |
NowMonotonic, NowRealtime | clock.hpp | ready |
ProcessCpuTime, ThreadCpuTime, Rdtsc | clock.hpp | ready |
ClockResolution, HasInvariantTsc, UsesVdso | clock.hpp | ready |
IClock, CManualClock, SystemClock | clock.hpp | ready |
CStopwatch | stopwatch.hpp | ready |
CDeadline | deadline.hpp | ready |
GetTime, GetTimeWithPrecision | time.hpp | old surface, kept |
Already in place, and covered in the last section of this document: CTimer, CTimerWheel, the calendar (SCivilTime), formatting and parsing of ISO 8601 / RFC 3339 / RFC 7231, the time zone, and SleepFor / SleepUntil.
The C ABI layer has existed since 2026-09-16. See its own section further down.
---
Measured performance
Release numbers, median of 200 thousand samples, each sample a batch of 64 reads. The median is used because a context switch in the middle of the loop shifts the mean and says nothing about the cost of the function.
| Measurement | Windows x64 (MSVC) | Linux x64 (GCC, on WSL) | Spec target |
|---|---|---|---|
NowMonotonic median | 18.75 ns | 22.00 ns | < 20 ns Windows, < 25 ns Linux |
NowMonotonic p99 | 26.56 ns | 23.70 ns | n/a |
NowRealtime median | 23.44 ns | 22.00 ns | n/a |
MulShift (conversion) | 0.78 ns | 1.27 ns | n/a |
| steady clock resolution | 100 ns | 1 ns | n/a |
| read without entering the kernel | yes | yes | required |
Both targets were met. Reproduce with:
cmake -S . -B build/bench -DCMAKE_BUILD_TYPE=Release -DETHEREAL_BUILD_BENCH=ON
cmake --build build/bench
./build/bench/bin/ethereal_bench_timeThe Linux number was taken on WSL, and there HasInvariantTsc reports nao (no) because CPUID arrives filtered. On a real Linux machine the number tends to be the same or better, but that is not measured.
Why the read is not inline
The spec asks for an "inlineable" read. It is not inlineable, and the reason is in the code: making NowMonotonic inline would require bringing <windows.h> into a public header, which poisons every translation unit of the customer. The measured median already includes the cost of the call and still stays within the target, so the price is paid.
---
Design notes
**The normal operators of SDuration do not check for overflow**, on purpose: they are the hot path. The checked variants (AddChecked, SubChecked, MulChecked, DivChecked, NegateChecked) return ETimeError. Since signed integer overflow is undefined behavior in C++, the normal operators do the arithmetic in ETL_UINT64 and convert back, which wraps around in a defined way.
Subtracting time points from different clocks is not a compile error. The tag is a field and not a type parameter, because the spec asks for 16 bytes with the tag inside. There is no assertion either, because ETL_ASSERT lives in the Assert module, and section 2 of the conventions forbids a module from including another module's header to obtain functionality. Instead there is Difference, which returns an error when the tags disagree. That is stronger than an assertion: the assertion disappears in release, and the returned error is still there.
The conversion arithmetic lives in a header (tickscale.hpp), outside the clock's .cpp. It is only used on Windows, because on POSIX clock_gettime already delivers nanoseconds. If it stayed in the .cpp, it would be code that one platform exercises and the other never touches. In the header, Linux measures it with synthetic frequencies against an exact oracle.
**MulShiftPortable has its own name and is always compiled.** Hidden behind an #if, it would be dead code on every machine of the project, because GCC has __int128 and 64-bit MSVC has _umul128. With its own name, the test suite checks the two paths against each other on every run, with 20 thousand draws from a fixed seed.
---
How this was verified
- 45 checks in the
timesection of the test suite, on both systems. - **A battery of
static_assert** over all of theSDurationarithmetic, including the edge cases of the most negative value. An arithmetic error breaks the build of the test suite. - Differential test between
MulShiftandMulShiftPortable. - Exact oracle for the conversion, at six frequencies, one of them a prime.
- 24 planted defects (13 in the core, 11 in the stopwatch and the deadline) (11 in the first sweep, plus two in a second one), all killed. Two of them exposed the test, and the code was right:
- the
static_assertbattery lived in a scratch file outside the project, so inverting the condition ofSubCheckedsurvived the entire test suite. - the
ThreadCpuTimetest only required the number to go up while burning CPU, which a wall clock also does. The complementary half was missing: while sleeping, it barely moves. - the
Restarttest only checked that the stopwatch started running again, and never that it reset to zero. - One equivalent mutant showed up and became a simplification. The
IsNevercheck insideExpiredchanged no result at all, because the sentinel is the largest representable time point and the clock would need 292 years to reach it. It was removed. - Windows caught a defect that Linux was hiding: a test compared two
Remaining()values read at different instants, and the evaluation order of the two sides of a<=is unspecified. It passed on GCC and failed on MSVC.
---
Section 8, item by item
| item | status |
|---|---|
| 1: unit tests | smoke.time, 90 checks |
| 2: differential | not applicable: one implementation per platform, no SIMD |
| 3: fuzz | not applicable: the module does not read untrusted input (no function parses text) |
| 4: sanitizer | linux-asan runs the entire test suite, clean |
| 5: baseline and gate | bench/time/baseline-linux.txt, gate at 5% |
| 6: build matrix | 7 configurations, plus C11 and C17 for the C layer (which was written for this) |
| 7: failing allocator | core.noalloc |
| 8: linked size | 179 KiB, and 172 of them do not belong to this module |
The intermittent test that was hiding behind a green ctest
The time section of smoke failed 2 times in 300 runs. ctest passed, because a single run passes almost every time. The case was:
const ETL_DOUBLE dT0 = Time::GetTimeWithPrecision();
Check( dT0 > 0.0, "GetTimeWithPrecision returns positive time" );A temporary probe printed the number on failure: dT0 = 0 exactly, with dT1 = 108 ns.
The function returns the time since initialization, and initialization happens inside the first call. Zero is the correct value when the clock does not advance between recording the mark and reading the mark. The test claimed more than the contract, and the intermittency was the test's own.
What the contract actually promises is that a valid read is not negative. The negatives are sentinels (-1 unknown platform, -2 no high-resolution counter). That is what the test requires now.
But >= 0.0 cannot fail on this platform: the numerator is unsigned and the divisor is positive. A condition the code cannot violate measures nothing, so the strong requirement moved to where it is legitimate. After the 200 ms of sleep the next case already performed, zero is no longer a possible answer and the read has to be strictly positive.
After the fix: 600 of 600 runs clean.
The allocator (item 7)
tests/core_alloc_guard.cpp, test core.noalloc, shared harness in tests/alloc_counter.hpp. It covers the five clock reads over 64 iterations, resolution/TSC/vDSO, the old surface (GetTime, GetTimeWithPrecision), CStopwatch with lap collection into the caller's space, and CDeadline.
Proven with a planted defect: a 56-byte allocation inside NowMonotonic produced 64 allocations, 3,584 bytes (exactly the 64 iterations) and also failed CStopwatch and CDeadline. As a bonus, this proves that those two really go through the clock.
The gate (item 5)
The median of a clock read is remarkably stable: the three keys stayed within the tight 5% the spec asks for, with no noise allowance. That is the opposite of the Compression module, whose throughput spreads from 16 to 55% on this same machine.
The unit tells the direction. Here the number is a median in nanoseconds, where lower is better: the limit sits above the value (23.1 ns against 22.0). A gate that assumed "higher is better" would take a clock read three times slower for an improvement. Proven with a planted defect: three clock_gettime calls instead of one took the median from 22.0 to 62.6 ns, and the gate failed.
The size (item 8), and the numbers that do not add up
| own sections of the four units | 4,002 bytes |
| linked cost of the module | 183,454 bytes (179 KiB) |
Forty-five times. The difference is in one line, time.cpp:94:
/* <Bundle> */ _BundleGuard( __FUNCTION__, __LINE__ ); /* </Bundle> */The license guard references Ethereal::BundleReserved::InternalGuard, and that pulls in the entire Bundle implementation. Measured in isolation, the guard costs 176,482 bytes (172 KiB), practically the entire marginal cost of time.cpp.o.
In other words: whoever links the clock links the licensing backend. Seventeen files in eleven modules carry the guard. encoding carries none, and that is why it costs 28 KiB.
The instrument had to be fixed in the middle of this. It measured the size of the linked file, which is page-aligned and therefore grows in steps of 4,096 bytes. When the C layer was added to encoding (2,528 bytes of code), the number came out identical to the byte, and only that drew attention. Today the verdict comes from the sum of the loadable sections. See the header of tools/module_size.sh.
This is not a defect to fix on one's own initiative. The guard exists because the library is sold under a Bundle license, and where it should live is the owner's decision. It is measured here so that the decision is made with the number in hand.
The matrix (item 6), and what is missing from it
The seven configurations build and run: Linux Debug/Release/ASan and Windows x64 and x86, Debug and Release.
The C11/C17 half is also closed, and the C layer had to be written first. Until then include/ethereal/c/time/ was an empty folder, and that gap belonged to section 7 (which asks for a C ABI layer per module), more than to section 8.
---
The C layer (section 7)
include/ethereal/c/time/time.h and src/c/time/time.cpp. Tests core.cabi and core.cabi.c17: the same source compiled under both standards, because a C header included only from C++ is not proven as C.
Three decisions deserve a record, and all three are about what did not become a handle:
- **Even reading the clock returns
int.** The convention requires every export to return a status, and the cost is that the time point comes out through a pointer instead of as the return value. The alternative (returning the time point and signaling an error with a magic value) forces every caller to know the magic value, and a caller who does not know it treats garbage as time. - The deadline is not a handle.
CDeadlineis eight trivial bytes. Wrapping the deadline would cost a create call and a destroy call to hold anint64, and it would hand the integrator a lifetime where none exists. It crosses as a POD, which is how the C++ side itself treats it. - **The arithmetic of
duration.hppdoes not cross.** It isconstexprand stateless: publishing a function call to add twoint64values would be worse than publishing nothing. What crosses is what C cannot do on its own: the clocks, their resolution, and the arithmetic that can overflow and therefore returns an error.
The stopwatch has state, and so it is an opaque handle over caller memory, as section 7 asks and as the Compression module already did.
The test was proven with planted defects
Four mutants in the new C layers, Time's and Encoding's, which the same core.cabi checks: accepting a zeroed iStructSize and ignoring the memory alignment (in Time), ignoring the uppercase option of hexadecimal and accepting an alphabet outside the list (in Encoding). Three died at once. The fourth survived and exposed the test. I was checking the second hexadecimal character of aBytes[0], whose value is 3, and "03" is two digits. The check could not tell any case apart. With 0xAB and both cases required, it dies.
---
What spec 01 had pending, and was closed
CTimer, CTimerWheel, the calendar, formatting and parsing of ISO 8601 / RFC 3339 / RFC 7231, the time zone, and SleepFor / SleepUntil are delivered.
| Piece | File | Status |
|---|---|---|
SCivilTime, conversions, date arithmetic | civil.hpp | ready |
LocalOffset, IsDaylightSaving, RefreshTimezone | civil.hpp | ready |
FormatRfc3339, ParseRfc3339 | format.hpp | ready |
FormatRfc7231, ParseRfc7231 | format.hpp | ready |
FormatLog (fixed-width stamp) | format.hpp | ready |
CTimerWheel, CTimer, STimerHandle | timer.hpp | ready |
SleepFor, SleepUntil, YieldThread | sleep.hpp | ready |
The C ABI layer covers all four: calendar, formatting, timer wheel and sleep.
---
The calendar does not go through the C library
The spec forbids mktime, localtime and gmtime, and the four reasons it gives are all true. Locale: the result depends on global state that another part of the program may have changed. Global state: gmtime returns a pointer to a static buffer that the next call overwrites, and two conversions in the same expression yield the same date twice. Threads, for the same reason. And speed.
What is here is Howard Hinnant's algorithm, which the spec names. It converts a civil date into days since 1970 with pure arithmetic, with no loops, no year tables and no leap-year branch. The idea is to move the start of the year to March. With that, the leap day becomes the last day of the year instead of sitting in the middle, and the length of the months fits in one expression.
Verification is by property, without depending on examples. The spec asks for "exact over the full supported range, property tested", and it is right. A table of hand-picked dates proves that those dates work, and a calendar algorithm fails precisely on the ones nobody picked. The test walks all 292,560 days from 1600 to 2400, one by one, and checks that the round trip is exact and that the sequence has no gaps.
A detail that separates correct dates from wrong ones before 1970: the division has to round down, never toward zero. -1 / 86400 in C gives 0, and day -1 would become 1970-01-01 instead of 1969-12-31.
The ISO week returns two numbers, and everyone forgets the second
The ISO week year is not always the year of the date: 2027-01-01 is a Friday and belongs to week 53 of 2026. Returning only the week would deliver half the answer, and the missing half is the one that breaks at the end of the year.
Adding months clamps the day, and that is not reversible
January 31 plus one month gives February 28, not March 3. There is no right answer here, only a chosen one. Clamping is what the spec asks for and what almost everyone expects, and the consequence is documented: adding one month and then subtracting one month gives January 28.
---
The 40 ns of formatting
"Target: format a full RFC 3339 timestamp with millisecond precision in under 40 ns."
| measured | |
|---|---|
| format RFC 3339 with milliseconds | ~20 ns (the target is 40) |
| parse the same | ~23 ns |
| memory allocations, in ten thousand of each | zero |
**snprintf is out because it interprets the format string at run time**, character by character, and consults the locale for the decimal separator. To write a date whose format is already known at compile time, that is an entire interpreter running for nothing.
The two-digit table is what removes the divisions. An RFC 3339 has five two-digit fields. With divisions that is ten divisions and ten remainders. With the table it is five divisions and five two-byte copies.
A defect the test caught, worth telling because it is of the silliest kind: the first version wrote u & 99u where it meant u % 100u, a bitwise AND in place of a remainder. 99 in binary is 1100011, and the AND with it yields garbage for almost every value. The eight formatting checks failed all at once, which is exactly how these errors get caught.
The caller provides the space. The functions return how many bytes were needed and, when they do not fit, write nothing. That way a small buffer never ends up holding half a date that looks whole.
Parsing is strict by default, and the lenient mode is about form
Strict mode requires an uppercase T, the exact number of digits in each field, and a zone. The lenient mode accepts what the real world has: a space in place of the T, lowercase t/z, and a missing zone.
The lenient mode never accepts a date that does not exist: a February 30 is still rejected in both modes. The tolerance applies to form, never to the calendar.
Second 60 is accepted, because the standard has it for leap seconds, and it is clamped to 59. SCivilTime does not represent it, and its header says so.
---
The timer wheel
"O(1) insert, O(1) cancel, O(1) amortized expiry. A priority queue is not acceptable here."
The spec is right to forbid the priority queue, and the less obvious reason is cancel. A binary heap gives O(log n) to insert, but canceling in it is O(n), unless the position of each element is stored. A system with many timers cancels more than it expires (every network request that answers in time cancels its deadline).
What is here is a hierarchical wheel of four levels of 256 slots, as the spec requires:
| level | per slot | covers |
|---|---|---|
| 0 | 1 ms | 256 ms |
| 1 | 256 ms | 65.5 s |
| 2 | 65.5 s | 4.66 h |
| 3 | 4.66 h | 49.7 days |
| measured | |
|---|---|
| arm, with one million live timers | 20 to 23 ns (the target is 50) |
| cancel | 20 to 24 ns (the target is 30) |
| cancel with ten thousand (fits in cache) | 10.7 ns |
The second and third rows together prove it is O(1): a hundred times more timers do not make cancel a hundred times more expensive. What changes is the cache, and the algorithm stays the same. An entry is 56 bytes, and one million of them are 56 MB against the 8 MB of L3 on this machine.
The cascade is what makes it "amortized". When level 0 wraps around, the next slot of level 1 is emptied and its timers are redistributed. Each timer moves down a level at most three times in its life, whatever the distance at which it was armed.
Callbacks run outside any lock, and the reason goes beyond performance. Expiring timers are taken off the wheel first, into a list of their own, and only then do the callbacks run. That is what allows a callback to arm, cancel or rearm timers (including its own), which is exactly what a retry system does. The test runs that case.
An honest note about the spec's "68 years". Four levels of 256 slots at 1 ms give 256⁴ ms, which is 49.7 days. The 68 years are what a 31-bit counter of seconds gives, which is a different thing. The implementation followed the numbers and set the conclusion aside. A timer armed beyond 49.7 days is not rejected: it stays in the last slot of the last level and is redistributed when the wheel gets there, which is what a hierarchical wheel does by nature.
---
Sleeping, and how far off it is
"Document the actual worst case wake latency measured per platform."
Measured on this machine (Windows 10, i7-6700), with twenty waits of each:
| request | average delay | worst |
|---|---|---|
| 500 ns | 0.0 µs | 0.1 µs |
| 50 µs | 0.0 µs | 0.1 µs |
| 1 ms | 35.7 µs | 455.9 µs |
| 10 ms | 455.5 µs | 953.9 µs |
What the test requires is that it never wakes early. Waking late is unavoidable and is measured. Waking early would be a defect, because whoever asks for 10 ms counts on 10 ms having passed.
The wait is a hybrid in three steps: busy-waiting with ETL_PAUSE up to 2 µs, yielding up to 60 µs, and the system wait above that, with the last 60 µs adjusted by the upper steps. That is why short waits are off by tenths of a microsecond and long ones by hundreds.
**timeBeginPeriod is not called, on purpose. It changes the clock of the entire process. A library that calls it makes the whole program (including code that has never heard of it) wake up more often and drain more battery. It is the kind of effect that shows up as "our laptop now lasts half as long" three months later, with nobody connecting the two. Instead, a high-resolution timer from Windows 10 1803 onward is used, which gives the same precision to this wait only**.
---
The time zone, and what this module does not include
"Do not ship a full IANA tzdb. Out of scope."
That is the right decision, because the time zone database changes. Governments change daylight saving rules with months of notice, and a copy of it compiled into a library goes wrong without anyone noticing. What is here is what the operating system says now, and the operating system gets updated.
The value is cached, and RefreshTimezone() is explicit because the value goes stale in two ways that do not notify the process: daylight saving time starts or ends, or someone changes the machine's time zone.
**On Linux and macOS the offset is read with localtime_r, and that does not contradict the spec's prohibition. What it forbids is converting the calendar** with those functions. What is read here is only the offset, once, and there is no other portable way to learn that value: it is information only the system has.
---
How this was verified
tests/time_civil.cpp, 71 checks, and the time section in tests/core_c_abi.c, compiled as C11 and as C17. Green in Debug and Release.
Beyond the calendar property, there is a second one worth having: twenty thousand random time points between 1969 and 2920 are written as RFC 3339 with nanoseconds and read back, and they have to yield exactly the same time point. That covers the writer and the reader at once, and it catches disagreements between the two that no example test would catch.
A trap of the module itself caught me while writing the test in C: ETLC_TimePoint rejects a struct with a zeroed iStructSize (which is how it arrives from a memset), and my test fell into it. That is the best possible proof that the rejection is worth having.
---
---
The CPU clocks are counted per tick, and the test needed to know that
Running the test suite in Debug with --parallel 8 made this test fail in two places. Both depended on a clock behaving as if it measured, when it samples.
ThreadCpuTime might not go up, and that is not its defect
The check burned twenty million additions and required the counter to go up. It failed once in every ten full runs.
**On Windows, GetThreadTimes and GetProcessTimes do not measure. They account by sampling at the scheduler interrupt, once every 15.6 ms.** Whatever is running when it fires gets the whole tick. Whatever is not running gets nothing, however much work it did between two interrupts.
With the machine under contention that is no longer rare. The loop takes tens of milliseconds in Debug, and even so the thread may not be the one running at any of the interrupts that cross it. The number stays the same, the > fails, and there is no defect at all in the clock.
Now the test burns until the counter moves, with a ceiling. If at the end it has not moved, that is a defect and the check reports it. The process clock sums all threads and so picks up ticks much more easily, but it is counted the same way and received the same treatment.
The other half of the check, "and barely goes up during 150 ms of sleep", needs none of this and stays as it was. It is the half that separates CPU time from wall time, and a wall clock always fails it.
The stopwatch had an absolute gate where it meant a relative one
the next lap counts only its own stretch slept 120 ms and required less than 200. The eighty of margin covered the timer granularity (which is what the comment already explained, and it is still right), but not the scheduling delay. With the machine under contention, a 120 ms sleep wakes well after the 200, and the check failed saying the previous lap had not been closed. It had been.
What it means to say is relative: this lap counts one sleep, not two. Now the stretch is measured with the wall clock, from outside, and the test requires that the stopwatch not report much more than that. If the previous lap had leaked, the number would come out a whole sleep higher: one hundred and twenty milliseconds, which no sixty-millisecond margin swallows.
That way the gate holds under any load: when the machine delays the sleep, it delays both clocks by the same amount. On an idle machine the two give 125.0 and 125.1 ms.
---
The floor guard, and why the first one put here did not work
The timer wheel targets (50 ns to arm and 30 ns to cancel, with one million live) are absolute. The measurement already kept the best of three passes, precisely so that a spike would not decide the result.
It was not enough. With the test suite running in Release, time.civil failed seven times in twelve runs.
The minimum protects against a spike, but not against a busy machine
Each pass arms and cancels one million timers over 56 MB. It is too long to escape sustained load: when the machine is full the whole time, all three passes come out spoiled and the minimum has nothing to choose from.
The first guard never fired, and it was right not to
It received the same floor as event.signal, a loop of integer additions. In the six runs where the target failed, it read between 1.21 and 4.21 ns, always below the limit of 5. In other words, it always said the machine was idle, while cancel reached 37.7.
And it was right. A loop that fits in the registers feels no shortage of bandwidth at all. When eight tests run at the same time, the contended resource is memory. That is exactly what cancel with one million depends on.
The proof was inside the test itself, printed for a long time: the cancel that fits in cache barely moves (11.9 alone against 12.9 with the test suite alongside), while the 56 MB one almost doubles.
The rule that stays: the floor has to suffer the same contention the measurement suffers. A floor that does not measure the scarce resource never fires. A guard that never fires is worse than none, because it gives the impression that the problem is handled.
The floor became a memory sweep
32 MiB against the 8 MiB of L3 on this machine, with a 64-byte stride: none of it stays in cache, and each step is a new line. Twenty calibration runs, ten alone and ten with the rest of the test suite in a loop:
| memory floor | cancel | |
|---|---|---|
| alone | 3.48 to 5.08 ns/line | 20.2 to 22.4 ns |
| under load | 5.19 to 8.43 ns/line | 20.5 to 48.9 ns |
The limit was set at 4.5: 29% above the typical floor of an idle machine and 13% below the lowest seen under load. On the sample it costs one run in ten alone (the one that read 5.08 and would have passed), and it lets none through under load.
That is the right side to err on. The gate exists to catch a regression in the code, and nine in ten clean runs are enough for that.
And it is a number for this machine
On another machine, the 32 MiB sweep costs something else and the limit has to be measured again. The table above is in the code precisely so that this method can be repeated, without guessing a new number.
Both floors are printed on every run, because they say different things: one speaks of the processor, the other of memory. Here the second one rules.
What is missing from spec 01
- The ten-minute run of the monotonic guarantee, with several threads confirming that the clock never goes backward. The property is guaranteed by the system's time source. What is missing is the long test the spec asks for.
- **
fuzzingof the parser**, which the acceptance table asks for with a long clean run. - ~~The sanitizers.~~ They have run since batch 3 (the
linux-asantrees, with ASan and UBSan, andlinux-tsan, on WSL). The Time tests pass clean on both. The nanosecond targets are not required there, because the number would belong to the instrumentation. - ~~A bridge table in the C layer.~~ Done on 2026-09-28. A timer armed on the C side and canceled before firing (a periodic one, always) did not return the 24 bytes of its callback bridge, nor the pending ones when the wheel was destroyed. ASan caught this in
core.cabi. Now the C wheel keeps one bridge per slot, indexed by the handle. Arming no longer allocates (except when the wheel grows), and canceling or destroying has nothing to return. - **
TimeToNextis not constant time. It scans up to 256 slots of level 0 and, if none has anything, returns the length of the level as an upper bound. That is enough for what it is for (whoever waits in an event loop wants to know how long it can sleep without overshooting** the next firing), and the code says so.