Time has several meanings
A displayed timestamp, a retry eligibility time and a measured duration serve different purposes. A laptop clock can jump, and worker clocks can disagree. Mixing those values can make leases expire early or leave overdue work apparently scheduled far in the future.
What to do next
- 01
Separate time representations
Store absolute instants for durable records and use a monotonic duration source for local performance measurement. Label client-displayed elapsed time as presentation rather than using it to authorize task transitions.
- 02
Centralize coordination comparisons
Where possible, claim and expire leases using the database's time within the same conditional operation. Avoid comparing a timestamp produced by worker A with a separately drifting local clock on worker B.
- 03
Inject clock movement
Test a forward and backward wall-clock adjustment in your application environment. Verify elapsed measurement remains meaningful, due work eventually progresses and no remote outcome is inferred solely from clock movement.
A concrete example
Illustrative example: the browser clock moves backward ten minutes while a job runs. The UI's local duration logic does not become negative, and the backend's scheduling decision remains based on its durable coordination clock.
Before you call it ready
- Browser time cannot expire server leases.
- Duration and timestamp fields are distinct.
- Clock movement has a controlled test.
When to stop or choose another method
Stop using unsynchronized client wall clocks to decide ownership, terminal job status or whether a new paid action is safe.
