As what I've learned from different documents, The "thing" that counts the time, we call it escapement. The escapement is used in all the shutters, but may not work for all shutter time.
For leaf shutters, all the shutter time is determined by the escapement (but some uses a special spring without escapement for the highest speed, like de earlier compur), there is an adjustable little "thing"(I forgot the name in english) that can determine the time that the escapement release the lever or cam.
Just as Landshark said, for mechanical focal shutters, for example Leica, the escapement only work for 1s-1/30 (nearly the same principle as that for leaf shutter). From 1/50 (flash sync) and higher speed, the exposure time is determined by the distance between the curtains. That means there is a cam linked with the axis of the first curtain. When the first curtain travels to a certain position, the second curtain release lever will be triggered by the cam, then the second curtain begins to release.
Hope that it helps.