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

Three Clocks are Better than One

Blog post from TigerBeetle

Post Details
Company
Date Published
Author
Joran Dirk Greef
Word Count
1,076
Language
English
Hacker News Points
-
Summary

TigerBeetle, a distributed database capable of processing a million financial transactions per second, emphasizes the critical need for precise timekeeping to ensure transaction safety and accuracy across different systems. During a presentation on Zig SHOWTIME, a Twitter poll revealed misconceptions about the best Linux monotonic clock for measuring elapsed time, highlighting the importance of CLOCK_BOOTTIME over the more commonly chosen CLOCK_MONOTONIC. CLOCK_BOOTTIME accounts for system suspension periods, which is crucial for accurate timing in scenarios like VM migrations. TigerBeetle adopts a fault-tolerant approach to time synchronization by using "cluster time," which aggregates multiple clocks to maintain accuracy even if some fail, addressing issues like quartz crystal oscillator drift and network time protocol (NTP) shortcomings. This approach ensures that even in partial network outages, TigerBeetle can operate without time-related errors, underscoring the necessity of understanding when to use stopwatch time versus wristwatch time for developing reliable software.