data.day

The Two-Clock Method: UTC for The Machine, Local Time for Humans

One timestamp cannot serve two masters. Learn the architectural pattern that separates 'System Time' (Evidence) from 'Wall Clock Time' (Context).

One Time to Rule, One Time to Serve

We exist in a duality. The Machine exists in a universe of absolute physics. The Human exists in a universe of relative perception.

When we design a system for contracts, logs, or communication, we often make the mistake of choosing one side.

  • The Engineer’s Mistake: Storing everything in UTC and displaying it in UTC. The client receives an email saying “Your appointment is at 14:00Z.” The client is confused. They miss the meeting.
  • The Manager’s Mistake: Storing everything in Local Time. The logs say “Upload at 9:00 AM.” The server moves to a different timezone. The history is rewritten.

The Vulnerability: The Lost Context.

Imagine a digital signature on a mortgage application. The server records: 2025-10-15 22:00:00 UTC. This is legally robust. It proves when it happened.

However, the user argues: “I signed this in the morning! This timestamp says late at night. This is fraud.”

The user remembers the sun shining through the window. They remember looking at their wall clock. It said 10:00 AM. Because we threw away their local context to satisfy The Machine, we have created a dispute. We have the facts, but we lack the narrative.

The Architecture: The Separation of Concerns.

We solve this by recording two distinct values for every significant event. We treat them as separate data types.

  1. System Time (The Anchor):

    • Format: UTC (ISO 8601).
    • Purpose: Sorting, auditing, database integrity.
    • Storage: created_at_utc.
    • This is the truth for the judge.
  2. Wall Clock Time (The Experience):

    • Format: Local Offset or Timezone Name.
    • Purpose: Customer support, user recall, narrative consistency.
    • Storage: user_local_offset (e.g., -05:00).
    • This is the truth for the user.

When we reconstruct the event later, we can say: “Mr. Smith, our records show the transaction occurred at absolute time X (UTC), which was 10:00 AM in your local timezone at that moment.”

This sentence satisfies both the mathematician and the memory.

Do not force the user to do mental math. Do not force the auditor to guess the location. Capture the physics and the perception. Store both.

FAQs

Why double the data?

Storage is cheap. Ambiguity is expensive. Storing an extra 8 bytes per record is a negligible cost compared to a forensic investigation.

Does this apply to small businesses?

If you have customers in more than one timezone, yes. Even if you are local, you likely travel. The problem follows you.

What if my software doesn't support this?

Then you must enforce it in your notes or metadata fields manually. 'Signed at 4PM (UTC-5)'.