Home / Companies / TigerBeetle / Blog / Post Details
Content Deep Dive

Tracking Time Without Clock

Blog post from TigerBeetle

Post Details
Company
Date Published
Author
matklad
Word Count
657
Company Posts That Month
2
Language
English
Hacker News Points
-
Post removed?
No
Summary

Handling time in reliable systems can be deceptively complex, even though it appears straightforward. Instead of relying directly on the time functions provided by programming language standard libraries, two code patterns are recommended to manage time effectively. The first pattern, known as "Call Site Dependency Injection," involves passing a single instance of the current time (an "Instant") to methods that need it, simplifying testing by allowing direct construction of time instances. This pattern is demonstrated through its use in adaptive replication routing, where it aids in measuring replication delays without needing a full clock interface. The second pattern focuses on scheduling future work by introducing a regular "tick" method within the system, which is invoked at a fixed cadence, simplifying control flow and reducing precision requirements for future scheduling. These patterns address the essential complexities of time handling, offering practical solutions for different scenarios without resorting to the complete virtualization of the clock.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
Real-time 3 6,551 1,245 236 +61%
Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.