# The current time: `clock.now`

`clock.now` is the time an operation started. It is fixed for the whole
operation, nested actions included, so every timestamp one request writes
agrees. A later request, schedule run or retry gets a new value. There is no
way to read a fresher time, and code never reads the system clock.

Only actions read the clock. Functions and queries must give the same answer
for the same arguments, so they take the time as a parameter
(`type.clock_context` otherwise). A query's condition may compare with
`clock.now`, which is then the calling action's
([Filters](filters.md)):

```jadpo
type ReminderCutoff = Instant {}

/// The latest due time a reminder goes out for now: an hour ahead.
action reminder_cutoff() -> ReminderCutoff {
    return ReminderCutoff(clock.now + 1h)
}

test "an action reads the test's clock" {
    clock: "2026-01-15T12:00:00Z"

    assert reminder_cutoff() == ReminderCutoff("2026-01-15T13:00:00Z")
    clock.advance(30m)
    assert reminder_cutoff() == ReminderCutoff("2026-01-15T13:30:00Z")
}
```

A test fixes the clock with `clock:` and moves it with `clock.advance(...)`,
as above ([Controlling time](controlling-time.md)).

Timeouts are measured on a separate clock that changes to the wall clock
can't move, and code never sees it. The SQL Jadpo generates always passes
the time as a value, and never uses the database's own `now()`. The
`random` namespace can be read only in actions in the same way
(`type.random_context`, [Randomness](randomness.md)).
