Skip to Content
Build a mod

Clock and replay protection

How to correct the game server clock with serverTime, how to generate the nonce of each request, and when to use CLOCK_UNSYNCED.

The game server clock is often wrong by a few seconds or minutes. If the connector trusted it, order deadlines and requests would fail silently. So the protocol uses the backend clock as the reference and asks the connector to correct its own.

Two rules

  1. The order deadline is valid on the backend clock. issuedAt and expiresAt are absolute times on the backend clock. The connector compares them only with the corrected time.
  2. Every request has a new nonce. It is the protection against replayed requests.

Correct the clock

Every response (success or error) carries serverTime. On every response:

  1. Calculate clockOffsetMs = serverTime - localClockAtReceipt. If you want, smooth it with the average of the last samples.
  2. Store the value and send it in the heartbeat.clockOffsetMs of each poll. It serves only as a drift alert. The order deadline always uses the backend clock.
  3. The corrected time is localClockNow + clockOffsetMs.

Use the corrected time in three places:

WhereField
Every requestsentAt
Every ACKat
Order deadline checkcompare with expiresAt

Time format: UTC, ISO 8601, always with milliseconds and Z, for example 2026-10-16T12:00:00.000Z.

An NTP jump on the host can change the local time in the middle of a run. To protect yourself:

  1. When you receive the order, calculate localDeadline = monotonicClockAtReceipt + remainingMs.
  2. Consider the order expired if either one of the two has passed: correctedTime > expiresAt or the monotonic clock went past localDeadline.

The remainingMs field also exists for runtimes without a date reader, such as DayZ's Enforce.

Request with the wrong time: CLOCK_SKEW

The backend accepts only requests with sentAt within ±300 seconds of its own time. Outside that, it responds:

JSON
{
  "ok": false,
  "serverTime": "2026-10-16T21:00:00.000Z",
  "error": {
    "code": "CLOCK_SKEW",
    "message": "sentAt fora da janela de ±300 s; ajuste o offset com serverTime e repita.",
    "retryable": true,
    "clientAction": "fix_clock"
  }
}

What to do:

  1. Recalculate clockOffsetMs with the serverTime of this error response.
  2. Build the request again with the corrected sentAt and a new nonce.
  3. Retry.

The first request after the game server starts is /session, and it uses the local clock still without correction. If CLOCK_SKEW comes, it is the normal path: correct and retry.

Replay protection (nonce)

To stop someone from resending an intercepted request, DROPSZ stores the nonce values it receives. The same nonce twice is refused with REPLAY_DETECTED.

How to generate the nonce:

  1. Use random bytes from a system generator.
  2. Write them as text of 16 to 64 characters in [A-Za-z0-9_-].
  3. Generate a new one on every request, including each retry of the same request.

Valid examples: n_poll_dayz_0005_x7Kp2QvLm9 and n_ack_dayz_0007_x7Kp2QvLm9.

Repeated the request? Generate another nonce

Reusing the nonce on a new attempt returns REPLAY_DETECTED. This applies to a retry after a network failure, RATE_LIMITED, CLOCK_SKEW, and any other case.

If REPLAY_DETECTED comes, the nonce was already used: generate a new one and repeat the request.

The protection has more layers, and two of them belong to the connector:

  • Orders: the orderId and seq saved on disk prevent running again (see Orders).
  • Channel: TLS with a verified certificate and a short session (see How the connector works).

No reliable time base: CLOCK_UNSYNCED

If the connector cannot establish the deadline safely, it does not run:

  • the runtime has no monotonic clock and
  • more than 10 minutes have passed since the last serverTime sample.

In this case, reject the order with an ACK rejected and reason: "CLOCK_UNSYNCED". When in doubt, do not run. The viewer gets a credit and nothing runs outside the deadline.

JSON
{
  "orderId": "ord_01JAD8K3QZ7XKM2P9RWT000004",
  "seq": 1044,
  "attempt": 1,
  "status": "rejected",
  "at": "2026-10-16T21:00:01.000Z",
  "reason": "CLOCK_UNSYNCED",
  "detail": "Sem amostra de serverTime há mais de 10 minutos."
}

(The example above follows the real ACK format. The detail is free text, up to 200 characters.)

Checklist

  1. Update clockOffsetMs on every response and send it in the heartbeat.
  2. Use the corrected time in sentAt and in at.
  3. Generate a new nonce on every request, including repeated ones.
  4. Handle CLOCK_SKEW with fix_clock: recalculate and retry.
  5. Calculate the monotonic deadline when the runtime has a monotonic clock.
  6. Use CLOCK_UNSYNCED when there is no reliable time base.

On this page