Shared clock for command code that can run both outside and inside Raft apply.
Outside Raft, command code uses the cluster-adjusted HLC time. Inside Raft apply, relative expiry and other time-derived command results must use the timestamp stored in the log entry so every replica computes the same state.
Summary
Functions
Returns the command time in milliseconds.
Runs fun with a stamped Raft apply time visible to command modules.
Functions
@spec now_ms() :: non_neg_integer()
Returns the command time in milliseconds.
If a Raft state machine apply scope installed a stamped log-entry time, that value is returned. Otherwise this falls back to the local cluster-adjusted HLC clock.
@spec with_now_ms(non_neg_integer(), (-> result)) :: result when result: term()
Runs fun with a stamped Raft apply time visible to command modules.