A request can exhaust its budget while its wall-clock timestamps suggest otherwise. Go’s time documentation [1] distinguishes measuring elapsed time from telling time. That boundary matters when a service also stores expirations, orders events, and runs reminders at a customer’s local hour.

For senior and staff interview practice, make each meaning of time explicit before choosing an algorithm. This guide uses a hypothetical reminder service to connect local deadlines, durable timestamps, causal order, and calendar schedules. The proposed decisions are practice examples; they are not a company’s interview criteria.

1. Define what each time value promises

Start with an observable contract

Consider this hypothetical prompt: design a reminder service whose API has an 800-millisecond request budget and whose users can request delivery every day at 09:00 in their chosen time zone. Workers restart, clocks can disagree, and customers can cancel reminders. Explain what the audit history means.

Ask where the budget starts, whether “delivery” means dispatch authorization or provider acceptance, and what cancellation can prevent. For this exercise, choose API receipt as the budget’s start. A cancellation acknowledged before dispatch authorization must prevent that authorization; an already authorized send may finish. Those are proposed product contracts, not consequences of a timestamp format.

Write separate invariants. An attempt must not receive a fresh end-to-end budget on retry. A recovered reminder must retain its intended occurrence. An audit record must distinguish a dependency from a display order. A local schedule must have an explicit rule for missing and repeated clock times.

Give timestamps names that describe their meaning

Use fields such as scheduled_for, received_at, and dispatch_authorized_at instead of a universal timestamp. In this design, the first names an intended occurrence, the second records one observer’s receipt, and the third records a state transition. Store the transition’s identity and version alongside its observed time.

Choose an interoperable representation for persisted instants. RFC 3339 [2] defines timestamps with UTC or numeric offsets; its scope does not supply future local-time rules. A value ending in -07:00 identifies an offset at that instant, not the continuing rules for a customer’s chosen region. Keep that distinction visible in the schema.

2. Use elapsed clocks for local budgets and wall time for durable instants

A deadline belongs to a clock domain

For a local request, measure elapsed time with a monotonic clock. In Go, time.Now() includes a monotonic reading, Add preserves it, and comparisons or subtraction use monotonic readings when both operands contain them. That supports a local deadline derived from the initial receipt time. Some platforms stop their monotonic clock during sleep, so suspend behavior also needs an explicit requirement. The package documentation [1] describes these boundaries.

Suppose the hypothetical API spends 300 milliseconds validating and reading state. Its next call gets a cap drawn from the remaining budget, with whatever completion reserve you choose to defend. Recompute the remainder before every attempt. Giving each retry another 800 milliseconds would change the promised total budget.

Across machines, a remaining-duration field can cap the receiver’s local work, but it does not independently account for unknown network transit time. An absolute deadline instead needs assumptions about clock disagreement. State the protocol’s choice and keep the sender’s original budget authoritative for its own further attempts. Neither encoding proves that downstream side effects stop when the caller stops waiting.

Restart recovery requires a new decision

A process-local deadline is not a durable expiration. Go omits monotonic readings from its serialized time forms because those readings have no meaning outside the current process. Parsed and unmarshaled times lack them. Serializing a deadline and reading it after restart therefore does not preserve the original elapsed-time comparison. Go serialization rules [1] make this limitation explicit.

Persist a wall-time expiration when the product needs a durable instant. On recovery, compare it using the designated time authority and the stated clock-error policy, then establish a new local timer if needed. Explain the consequence: a wall-time expiration retains meaning across restart, while its enforcement still depends on that authority’s accuracy. For this reminder service, choose the database as the authority for durable eligibility checks.

Even “database time” needs precision. In PostgreSQL, now() and transaction_timestamp() return transaction start; statement_timestamp() returns statement start; clock_timestamp() can change during a statement. A transaction held open before an expiration check can therefore make now() older than the eligibility decision you intended. Choose the function according to the contract, and review transaction duration. PostgreSQL’s definitions [3] distinguish all three.

3. Separate timestamp order from causal order

Sorting audit records does not establish a dependency

Imagine that service A acknowledges cancellation and sends a message to service B. B records receipt with a clock reading earlier than A’s recorded send time. That hypothetical history should preserve the message dependency even when displayed wall times look reversed. Recording message identifiers, parent identifiers, and state versions makes the dependency inspectable.

Lamport’s happened-before relation follows process order, message send-to-receive order, and transitivity. Logical clocks satisfy the implication that if event A happened before B, A’s logical timestamp is smaller. The reverse implication does not hold: a smaller Lamport timestamp does not prove a causal dependency. A process identifier can break ties for a consistent total order, but that ordering adds no evidence that independent events caused each other. Lamport’s original paper [4] states this distinction.

For the reminder example, specify that cancellation and dispatch authorization compete through the authoritative reminder state. Audit timestamps describe that decision; they should not replace the decision mechanism. Otherwise, “choose whichever event has the later wall time” quietly becomes the cancellation policy, including its behavior when clocks disagree.

HLC and bounded uncertainty solve different problems

CockroachDB documents a hybrid logical clock with physical and logical components and propagates HLC timestamps between nodes. This combines a relationship to wall time with logical advancement. Its architecture also documents clock-offset enforcement and consistency implications. Treat HLC as part of that database’s protocol, rather than assuming that attaching two numbers to application events automatically provides the database’s guarantees. CockroachDB’s transaction-layer documentation [5] explains the context.

Clock synchronization remains an assumption to inspect. NTP’s specification models offset, delay, dispersion, and jitter; a claim that “NTP is enabled” does not establish zero uncertainty. Ask how the system monitors synchronization and what it does when the permitted error is exceeded. RFC 5905’s performance model [6] supports that distinction.

Spanner offers a scoped comparison. Its TrueTime API returns an interval that bounds uncertainty, and its transaction protocol uses commit wait to support external consistency. The original paper makes the guarantees depend on those bounds. This is a protocol with a time infrastructure and waiting costs, not a general rule that UTC timestamps establish real-time transaction order. The Spanner paper, sections 3 and 4 [7], supplies the underlying argument.

4. Treat a daily local schedule as a calendar rule

Preserve the customer’s intention

For the hypothetical 09:00 reminder, store the local recurrence and a named zone such as America/Los_Angeles. Use a computed next UTC occurrence for dispatch, while retaining the rule that produced it. IANA updates its time-zone database when political decisions change boundaries, offsets, or daylight-saving rules. Future scheduling therefore needs a policy for incorporating those updates. IANA’s database description [8] explains why a named zone contains more information than a fixed offset.

Extend the prompt to a customer requesting 02:30 in a zone with a spring-forward gap. Choose whether to skip, move to the next valid local time, or reject the configuration. For a repeated local time, choose the first occurrence, the second, or both. Make the occurrence identifier reflect that choice so a replay does not reinterpret the customer’s schedule.

These choices are product-specific. AWS EventBridge Scheduler documents skipping a nonexistent cron time and invoking only once during a repeated time. It also defines rate(1 days) as a 24-hour duration, including across daylight-saving transitions. A daily calendar schedule and a recurring duration therefore need separate requirements. EventBridge Scheduler’s daylight-saving rules [9] are one concrete implementation.

Define lateness separately from recurrence

Now make the scheduler unavailable for several hours. Should recovery send every missed reminder, send the most recent one, or skip stale occurrences? For this exercise, choose a bounded lateness window and record skipped occurrences with a reason. Keep the intended occurrence separate from actual dispatch time so an operator can explain the outcome.

Kubernetes CronJobs provide a useful comparison: startingDeadlineSeconds limits delayed starts, while concurrency policy controls overlapping executions. The documentation also warns that scheduling can produce two Jobs or no Job and recommends idempotent work. These are distinct controls; configuring recurrence alone does not settle recovery or duplicate handling. Kubernetes CronJob documentation [10] describes the boundaries.

5. Rehearse failures and review the explanation

Turn assumptions into observable checks

Practice the design with a controllable clock and an explicit event history. Keep wall-time and elapsed-time inputs independently adjustable. The following exercises are illustrative engineering checks for this prompt, not reported incidents or a standardized interview test:

  • Move wall time backward during a request. Verify that its local elapsed budget still controls further attempts and that audit records retain their stated meanings.
  • Restart before a durable expiration. Verify that recovery reads the persisted instant, applies the authority’s clock policy, and creates any new local timer without assuming monotonic continuity.
  • Deliver a dependent message with reversed wall timestamps. Verify that the recorded dependency remains visible and that display sorting does not change the authoritative state decision.
  • Cross a daylight-saving transition during an outage. Verify the chosen gap or overlap rule, lateness window, occurrence identity, and recorded reason for any skip.

For each exercise, predict the outcome before running it. Identify the state you would inspect and the evidence that could disprove your explanation. A passing test should establish a named property under its assumptions; avoid treating one successful run as proof of every clock or scheduling behavior.

Use an explicitly illustrative practice rubric

Review your mock answer along four dimensions: did you define the product’s time contracts, assign each decision a suitable clock, preserve meaning across process and machine boundaries, and explain recovery when assumptions fail? Mark each dimension as clear, incomplete, or unsupported, then repeat the weakest explanation with a different failure injected. This is a self-review aid, not an employer’s grading system or a prediction of hiring outcomes.

The useful practice artifact is a page of contracts and counterexamples that you can defend aloud. A clock reading becomes useful only after you explain what decision it supports, which assumptions make that decision valid, and what happens when those assumptions fail. Create an Interview Copilot account to organize your interview preparation, then use this hypothetical prompt in your next mock design session.

Sources & References

  1. [1] Go time package: Monotonic Clocks — elapsed measurements, serialization, and suspend behavior.
  2. [2] RFC 3339: Date and Time on the Internet: Timestamps — timestamp representation and numeric offsets.
  3. [3] PostgreSQL 16: Current Date/Time — transaction, statement, and actual current-time functions.
  4. [4] Leslie Lamport: Time, Clocks, and the Ordering of Events in a Distributed System — happened-before and logical ordering.
  5. [5] CockroachDB: Transaction Layer — hybrid logical clocks and clock-offset enforcement.
  6. [6] RFC 5905: Network Time Protocol Version 4 — clock-synchronization performance and error model.
  7. [7] Corbett et al.: Spanner: Google’s Globally-Distributed Database — bounded uncertainty, commit wait, and external consistency.
  8. [8] IANA: Time Zone Database — named-zone rules and political changes.
  9. [9] AWS: Schedule Types in EventBridge Scheduler — product-specific daylight-saving and duration behavior.
  10. [10] Kubernetes: CronJob — delayed starts, concurrency policy, and scheduling limitations.