The world's first mechanical clock was built by the Chinese Tantric Buddhist monk and mathematician I-Hsing. This was actually an astronomical instrument which served as a clock, rather than simply a clock. A contemporary text describes it:

[It] was made in the image of the round heavens and on it were shown the lunar mansions in their order, the equator and the degrees of the heavenly circumference. Water, flowing into scoops, turned a wheel automatically, rotating it one complete revolution in one day and night [24 hours]. Besides this, there were two rings fitted around the celestial sphere outside, having the sun and moon threaded on them, and these were made to move in circling orbit. Each day as the celestial sphere turned one revolution westwards, the sun made its way one degree eastwards, and the moon 137/19 degrees eastwards. After twenty-nine rotations and a fraction of a rotation of the celestial sphere the sun and moon met. After it made 365 rotations the sun accomplished its complete circuit. And they made a wooden casing the surface of which represented the horizon, since the instrument was half sunk in it. It permitted the exact determinations of the time of dawns and dusks, full and new moons, tarrying and hurrying. Moreover, there were two wooden jacks standing on the horizon surface, having one a bell and the other a drum in front,of it, the bell being struck automatically to indicate the hours, and the drum being beaten automatically to indicate the quarters. All these motions were brought about by machinery within the casing, each depending on wheels and shafts, hooks, pins and interlocking rods, ,stopping devices and locks checking mutually [i.e. the escapement].

   Since the clock showed good agreement with the Tao of Heaven, everyone at that time praised its ingenuity. When it was all completed in 725 AD it was called the 'Water-driven Spherical Birds'-Eye-View Map of the Heavens' and set up in front of the Wu Ch'eng Hall of the Palace to be seen by the multitude of officials. In 730 AD candidates in the imperial examinations were asked to write an essay on the new astronomical clock. The text continues:

  But not very long afterwards the mechanism of bronze and iron began to corrode and rust, so that the instrument could no longer rotate automatically. It was therefore relegated to the museum of the College of All Sages and went out of use.

More...