# 🔧 Field Note 02: The Two Clocks
### Separating Reality from Knowledge in the Ledger
**By Lund Consulting | Der Maschinenraum**
In [[FN 01 - The Overwrite Fallacy]], we identified the **Overwrite Fallacy**:
If your system only has one clock, **even an "append" is an overwrite.**
Insert a late invoice using only a "Service Date," and you’ve retroactively altered what you knew when last quarter closed and reports were signed.
The solution is **Two Clocks**:
Every record must be governed by two independent timelines.
In this episode, we offer an exhaustive framework for understanding the two clocks.
---
## Definitions
1. **Reality (`event_date`):** When the fact is true in the real world.
2. **Database Knowledge (`knowledge_date`):** When the database learned about it.
In a perfect world, these clocks tick in unison. But in the real world, they diverge.
These divergences are precisely where a firm needs a robust defense.
| **Divergence Type** | **Logic** | **Business Meaning** |
| ------------------- | ------------------------------- | ------------------------------------------------- |
| **Delay** | `event_date` < `knowledge_date` | Recording something that happened in the past |
| **Correction** | `event_date` < `knowledge_date` | Fixing a mistake about a past event |
| **Plan** | `event_date` > `knowledge_date` | Projecting a future event (e.g. future cashflows) |
---
## 1. Delay
This is the scenario from Field Note 01.
- **Mar 31:** Service rendered (Q1).
- **Apr 05:** Invoice entered into the system (Q2).
```mermaid
gantt
  title The Gap Between Reality and Database
  dateFormat YYYY-MM-DD
  axisFormat %b %d
  section Reality
  Service Delivered (Mar 31) :crit, active, 2024-03-31, 1d
  section Database
  System Ignorance      :done, 2024-03-31, 2024-04-05
  Record Created (Apr 5)   :active, 2024-04-05, 1d
```
The database row for this late invoice looks as follows:
| **Business ID** | **Amount** | **event_date** | **knowledge_date** |
| --------------- | ---------- | -------------- | ------------------ |
| INV-101 | $50k | 2024-03-31 | **2024-04-05** |
---
## 2. Correction
We are changing our understanding of a past event.
****Scenario:**
- **Apr 05:** Recorded a $5k cashflow.
- **Apr 15:** Realized the cashflow should have been $50k.
```mermaid
gantt
title Correcting $5k to $50k
dateFormat YYYY-MM-DD
axisFormat %b %d
section Reality
True amount ($50k) :crit, active, 2024-04-05, 1d
section Database
Knowledge V1 (False) ($5k) :done, 2024-04-05, 10d
Knowledge V2 (True) ($50k) :active, 2024-04-15, 10d
```
The database records this correction through an additional row:
| **Business ID** | **Amount** | **event_date** | **knowledge_date** |
| --------------- | ---------- | -------------- | ------------------ |
| INV-202 | $5k | 2024-04-05 | 2024-04-05 |
| INV-202 | $50k | 2024-04-05 | **2024-04-15** |
This logic of correction also works for **cancellation**.
To "cancel" an amount, just insert a new record that records the truth (0).
Here is how a database looks, when you're cancelling an amount of $80k.
| **Business ID** | **Amount** | **event_date** | **knowledge_date** |
| --------------- | ---------- | -------------- | ------------------ |
| INV-203 | $80k | 2024-04-05 | 2024-04-05 |
| INV-203 | 0 | 2024-04-05 | **2024-04-15** |
In a future season, we will look at the concept of "cancellation" more generally:
- When is it better to book a zero with a new knowledge_date?
- When is it better to follow the accounting approach of booking a reversal?
---
## 3. Planning (and Later Realized Truth)
We record our projection about the future.
Later when the future actually comes, we record the truth.
**Scenario:**
- **Nov 30th:** we project a cashflow of $10k for Dec 31st .
- **Dec 31st:** we realize the amount is actually $12k.
```mermaid
gantt
title Planning vs. Realized Truth
dateFormat YYYY-MM-DD
axisFormat %b %d
section Reality
Actual Cashflow ($12k) :crit, active, 2024-12-31, 1d
section Database
Initial Projection ($10k) :done, 2024-11-30, 2024-12-31
Realized Truth ($12k) :active, 2024-12-31, 10d
```
| **Business ID** | **Amount** | **event_date** | **knowledge_date** |
| --------------- | ---------- | -------------- | ------------------ |
| CF-999 | $10k | 2024-12-31 | 2024-11-30 |
| CF-999 | **$12k** | 2024-12-31 | **2024-12-31** |
---
## Summary: The Two Clocks provide an exhaustive framework
The two clocks - event date and knowledge date - provide an exhaustive framework for various data manipulation scenarios.
- **Delay:** We were slow to record the past.
- **Correction:** We were wrong about the past.
- **Projection:** We are planning for the future, and we are ready to record the truth once that future arrives.
In future episodes, we will dive into the SQL, and explain how to implement the two clocks without compromising system performance.
---
### _Der Maschinenraum_
Field notes from our disciplined implementation projects.
For any questions, comments or inquiries, please comment on our LinkedIn Post or reach out to us directly:
[email protected]