↓ Skip to main content

“The answer is: very often, like 5% of all samples, when reading the clock on all 4 physical cores at the same time.”

Evan Jonesevanjones.ca ↗

On Linux, Jones saw about 5% of timestamps match another thread’s exactly, and 2% even with just two threads on four cores. On macOS the absolute clock only has microsecond resolution, so collisions are astronomical. A nanosecond timestamp sounds unique because the number is long. The clock behind it is not that precise.