The lower-ranking women come first, the higher-ranking come last. The assistant concubines, eighty-one in number, share the imperial couch nine nights in groups of nine. The concubines, twenty-seven in number, are allotted three nights in groups of nine. The nine spouses and the three consorts are allotted one night to each group, and the empress also alone one night. On the fifteenth day of every month the sequence is complete, after which it repeats in the reverse order.

  The emperor, known as the Son of Heaven, was full of a powerful yang force, which was the essence of masculinity. But he needed to be fed with a matching yin force, the essence of femininity, to achieve a balance. At the time of the full moon, when the yin force was at its peak, the empress would sleep with the Son of Heaven, feeding him with her powerful yin. This would be the most propitious time for a conception to take place. The lesser women, during the time of the Moon's waning, had to sleep with the emperor in groups in order to pool their respectiveyin forces to overcome the lack of the Moon's strength. For most of the nights of his life, therefore, the emperor slept with nine women at a time.
  If a likely lad were to be chosen to be the next emperor, the astrologers would go back to the precise time of his conception, plot the stars which were culminating and consider any comets or novae, or other astronomical phe- nomena. If the astrological configurations were indicative of a strong leader, a valiant warrior, or whatever, this would weigh in the young prince's favor. But the eldest son might well have been born under the influences of stars concerning death or disaster. So he would be ruled out quite early on.
  But let us see what the situation was at about the time when the mechanical clock was invented in China. Was the succession principle operating very well? In the ninth century, Pai Hsing-Chien bewails the chaos of the system. We read in his Poeticai Essay of the Supreme Yoy:

Nine ordinary companions every night, and the empress for two nights at the time of the full moon - that was the ancient rule, and the secretarial ladies kept a record of everything with their vermilion brushes.... But alas, nowadays, all the three thousand palace women compete in confusion.

  Clearly, the succession to the throne was in peril. Bad princes might be chosen. The timing of their conceptions was not being noted properly. Time for a clock to be invented! And in 725 AD, this was done.
  The Chinese did not invent the first clock of any kind, merely the first mechanical one. Water clocks had existed since Babylonian times, and the earliest Chinese got them indirectly from that earlier civilization of the Middle East, just as they got much of their earliest forms of astronomy from them. The Chinese certainly did invent improved water clocks of various kinds, including a 'stop-watch' portable one which used mercury rather than water and measured small periods of time. It used weighted balances, or steelyards, rather than just a rising indicator in a bucket as water flowed in and buoyed it up. But these were improvements of an invention which was not originally Chinese. Nor did the Chinese invent the clock dial. That was an invention of either the Greeks or the Romans, and is mentioned by the architectural writer Vitruvius in the first century BC.

More...