explain to me how a clock works in precise detail