3 ms·
Ask HN: Is a 1Mhz CPU precisely 1Mhz? How are clock crystals so accurate?
When programming something timing dependent it is often necessary to very precisely time things.
So I'm wondering if the system clock really is precisely the megahertz advertised?
And if so, how are crystals made so precise?
- retrac 5y agoGenerally accurate to dozens or hundreds of parts per million. A few seconds gain or lost per month. Piezoelectric crystals work on much the same principle as pendulums and tuning forks. They are precise shape and size, and they will oscillate very, very accurately. They actually look like miniature tuning forks. As to how they're made, the crystal is cut with a laser until it matches a reference source. https://en.wikipedia.org/wiki/Quartz_clock https://en.wikipedia.org/wiki/Quartz_clock
- downrightmike 5y agoPower of twos math: quartz crystal oscillate at a frequency of 32768 (= 2^15) Hz and generate digital pulses once per second.
- News-Dog 5y ago'Tick, Tock goes the Clock' Quartz clock : https://en.wikipedia.org/wiki/Quartz_clock https://en.wikipedia.org/wiki/Quartz_clock Crystal Oscillator : https://en.wikipedia.org/wiki/Crystal_oscillator https://en.wikipedia.org/wiki/Crystal_oscillator Phase-Locked Loop (PLL) : https://en.wikipedia.org/wiki/Phase-locked_loop https://en.wikipedia.org/wiki/Phase-locked_loop Ceramic Resonator : https://en.wikipedia.org/wiki/Ceramic_resonator https://en.wikipedia.org/wiki/Ceramic_resonator Atomic Clock : https://en.wikipedia.org/wiki/Atomic_clock https://en.wikipedia.org/wiki/Atomic_clock Rubidium Standard : https://en.wikipedia.org/wiki/Rubidium_standard https://en.wikipedia.org/wiki/Rubidium_standard
- mikewarot 5y agoThe clock chips on most modern computers can be expected to be within 10 parts per million, so you might gain or lose a second or two per day. If the computer is synchronized to an NTP server, your long term accuracy and precision should be far better. You should be made aware of the many, many falsehoods programmers believe about time - https://gist.github.com/timvisee/fcda9bbdff88d45cc9061606b4b923ca https://gist.github.com/timvisee/fcda9bbdff88d45cc9061606b4b...
- ozzythecat 5y agoThat Git is just a massive list of statements. It points to a couple external links for more information. Unless my browser is just broken, there’s just a few paragraphs on the first link. There’s no worthwhile discussion on the myriad statements. More egregiously, the page hijacked the back button in Safari, refusing to let me go back. 0/10 would not recommend.
- mikewarot 5y agoHere's a movie about how crystals were made in the days before automation. https://www.youtube.com/watch?v=wHenisSTUQY https://www.youtube.com/watch?v=wHenisSTUQY Modern processes likely still use lapping to get the right thickness and hence frequency.