It's Go Time on Linux
Mar 5, 2014Albert Strasheim

Summary
This post delves into the specifics of how Go programs on Linux obtain the current time, highlighting the evolution from older system calls like `time` and `gettimeofday` to the more precise `clock_gettime`. It details Cloudflare's adoption of the Linux vDSO (Virtual Dynamically linked Shared Objects) mechanism for low-overhead time retrieval, significantly improving performance for `time.Now()` and `runtime.nanotime`. The post also includes benchmarks demonstrating the performance gains and discusses the importance of accurate timekeeping for various system functions and potential pitfalls like Y2K and leap second bugs.
More from the Data Infrastructure & Analytics trail
- Introducing Cloudflare Basin: an open, serverless data platform, now generally available
- Introducing the Billable Usage API: programmatic cost visibility for Cloudflare
- Announcing the Monetization Gateway: charge for any resource behind Cloudflare via x402
- How we built Cloudflare's data platform and an AI agent on top of it
- Iran's Internet is partially restored, Cloudflare Radar data shows