All perfect praise be to Allaah, the Lord of the worlds. I testify that there is none worthy of worship except Allaah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
A Muslim is required to regularly observe the prayers in their prescribed fixed times. Also, he has to utilize the available means to wake up for prayer, otherwise he is considered negligent.
As for the case under question, it seems that the questioner performs the Subh prayer on time (i.e. before sunrise) because darkness is still there. If he prayed thinking that he did so on time and then found out that he did so only after the time had expired, the prayer is valid and he is not required to make up for it. Likewise, the prayer is also valid when he prays thinking that the sun rose and then later discovers that he prayed on time. The intention for performing the prayer on time is valid for making up a prayer and vice versa. However, this is permissible when one does so unintentionally. The Maaliki scholar Shaykh ‘Ilaysh said:
"A prayer is valid when one performs it with the intention of making up for it even though it was prayed on time. Likewise, it is valid when one performs it with the intention of praying on time even though its time expired. One has to perform the prayer with the intention of praying on time when it is prayed in its fixed time and with the intention of making up a prayer after the time expires. Both intentions are workable in both cases, as long as he does so unintentionally; as when he prays thinking that he is doing so on time and then finds out that he did so only after the time had expired and vice versa. Deliberately having a different intention on the other hand, renders the prayer invalid."
The Hanbali scholar Ibn Muflih said: "A prayer is valid when one performs it with the intention of making it up and then finds out that its time had not yet expired and vice versa. This is the opinion of the Hanbali scholars. Doing this deliberately, however, renders the prayer invalid, as mentioned by Al-Mardawi . Ibn Tameem said: "There is a consensus that making up for the prayer is not required."
Allaah Knows best.