/api/v1/clock
The instant the server believes it is. Defined in crates/rest/src/clock.rs.
Every timestamp the API returns comes from this clock, so a test that wants to observe a cooldown or an expiry moves the clock rather than waiting.
GET /
Returns the current server time. Needs no authentication.
GET /api/v1/clock
{
"time": "2021-01-15T14:17:14.015Z"
}
Errors
None.
PUT /
Moves the clock forward, and answers with the time it now reads.
Development only. The route exists on every build, but it only works when
the backend runs with a virtual clock — clock = "virtual" under [backend]
in the configuration. On a server with the system clock it answers 403
with the plain-text body dev clock API is disabled, not the usual JSON error
object.
The clock only ever advances: the body is a target, and asking for an instant already in the past leaves it where it is. The response says what the clock actually reads afterwards, which is the value to trust.
Body
| Field | Type | Meaning |
|---|---|---|
time | timestamp | The instant to advance to. |
Example
PUT /api/v1/clock
Content-Type: application/json
{"time": "2021-01-31T00:00:00.000Z"}
{
"time": "2021-01-31T00:00:00.000Z"
}
Errors
| Status | Body | When |
|---|---|---|
| 403 | dev clock API is disabled (plain text) | The instance runs on the system clock. |