Abu Huraira reported God’s messenger as saying, “When God created Adam He wiped his back and every soul of his offspring He was to create up to the day of resurrection fell from his back. He put on the forehead of everyone of them a flash of light, then presented them to Adam who asked, ‘My Lord, who are these?’ He replied, ‘Your offspring.' On seeing one of them and being charmed by the flash on his forehead he asked, ‘My Lord, who is this?’ He replied, ‘David.’ He asked, ‘My Lord, how long a term of life hast Thou appointed him?” He replied, ‘Sixty years.’ He said, ‘My Lord, give him an extra forty years out of my term of life.’” God’s messenger said, “When Adam’s period of life all but forty years had come to an end the angel of death came to him. Adam said, ‘Are there not forty years of my life remaining?’ He replied, ‘Did you not give them to your son David?' Adam denied it and his offspring denied; Adam forgot and ate of the tree and his offspring forgot; and Adam sinned and his offspring sinned.” Tirmidhi transmitted it.
Hadith Referenceمشكوة المصابيح / كتاب الإيمان / 118
Hadith Gradingالألبانی:حسن | زبیر علی زئی:إسناده حسن
Hadith Takhrij´تحقيق و تخريج: محدث العصر حافظ زبير على زئي رحمه الله` «إسناده حسن، رواه الترمذي (3076 وقال: ھذا حديث حسن صحيح) [وصححه الحاکم 2/ 586]»
Hadith Authentication: The chain of narration for this report is hasan (good). Al-Hakim has also declared it sahih (authentic). [حاکم 586/2]
Jurisprudence of the Hadith: ➊ In this narration, "light" refers to the light of faith (iman) and sound natural disposition (fitrah salimah). ➋ Forgetfulness is included in human nature. ➌ This hadith is an explanation of Surah Al-A'raf, verse 172. ➍ Sayyiduna Dawud (alayhis salam) was very handsome. ➎ The lifespan of every living being is as much as is written in its destiny, and when the appointed time of death arrives, then nothing can avert it. ➏ Love for a long life is included in human nature. ➐ From the time of Sayyiduna Adam (alayhis salam) until the Day of Resurrection, all human beings are the children of Adam (alayhis salam) and Hawwa (alayhas salam), that is, Sayyiduna Adam (alayhis salam) is the father of all mankind.
Source: Adwa al-Masabih fi Tahqiq Mishkat al-Masabih, Page: 118