advancingClock function

DateTime Function() advancingClock({
  1. DateTime? from,
  2. Duration step = const Duration(seconds: 1),
})

A monotonically ADVANCING clock (FT-1, tg-pez) — each call returns the next instant step apart, starting at from (default DateTime(2026)). Feed to RecordingCapabilityRegistry.new's nowFn so the host's kick and terminal read DISTINCT instants, proving startedAt < finishedAt and a deterministic durationMs (the first two now() calls of a clean transition are step apart).

Implementation

DateTime Function() advancingClock({
  DateTime? from,
  Duration step = const Duration(seconds: 1),
}) {
  var next = from ?? DateTime(2026);
  return () {
    final current = next;
    next = next.add(step);
    return current;
  };
}