API reference › @evolu/common › local‑first/Timestamp › sendTimestamp
function sendTimestamp(
deps: TimestampConfigDep,
): (
timestamp: Timestamp,
now: number &
Brand<"NonNaN"> &
Brand<"Finite"> &
Brand<"Int"> &
Brand<"NonNegative"> &
Brand<"LessThan281474976710655"> &
Brand<"Millis">,
) => Result<Timestamp, TimestampError>;
Defined in: packages/common/src/local-first/Timestamp.ts:523
Advances a Timestamp for a local event.
Counter exhaustion rolls into the next logical millisecond. Rollover past the
timestamp range returns TimestampTimeOutOfRangeError. The resulting
timestamp is checked for drift, including after rollover; a failure returns
TimestampDriftError with the candidate and cause: "local". Pass the
request's captured system time so replay produces the same result.
Example
import { assertOk, Millis } from "@evolu/common";
import {
createTimestamp,
maxCounter,
sendTimestamp,
} from "@evolu/common/local-first";
const before = createTimestamp({ counter: maxCounter });
const result = sendTimestamp({ timestampConfig: { maxDrift: 1 } })(
before,
Millis.orThrow(0),
);
assertOk(result, { ...before, millis: Millis.orThrow(1), counter: 0 });