Buy a selection of cheap, throw away toys from your local toy store, or supermarket. Keep them in a bag and give the child one new toy every hour. As long as you choose your selection carefully, you should hopefully keep their attention for long enough to help past the time.
If it's a long flight, you might also loiter at the rear of the aircraft, where there is usually a little space next to the bank of toilets, as well as a galley. The flight attendants are usually quite friendly to young children and wont mind if you hang around a while.
No offence Sazzy etc, but giving your child unprescribed medicine is both irresponsible and downright dangerous. Children's bodies are much less tolerant of drugs than adults, as their Liver is small and less able to break down the medicine. The affects of dehydration in an airplane cabin add to the potential risks.
Furthermore, the internal pressure of the airplane is equivalent to being at an altitude of 6,000-8,000 feet on most aircraft. That's equivalent to being at an altitude that is more than 2x the height of Hong Kong's highest mountain. Being at high altitude affects the bodies in a number of different ways, including affecting the absorption of drugs. This is precisely the reason why you will get drunk quicker, and more easily when drinking alcohol at altitude. The same goes for your childs body, if taking medicine in an aircraft.
I would never, ever endanger my child by giving them unprescribed medicine on a flight. Why risk your child health, just for the sake of catching a little extra rest? It's just not worth the risk.