Shaykh Ahmad bin Yahya an-Najmi (Rahimahullaah ) was asked:
Question: What is the ruling on the fast of one who ate or drank thinking that Fajr has not appeared, (but then) it became clear that it has appeared; or (he thinks) that the sun has set, (but then) it became clear that it has not set?
Answer: “If he ate or drank (whilst) doubting (whether) Fajr has appeared and it is not clear to him, his fast is correct and there is no Qadaa upon him (i.e. he does not have to make up for the fast on another day). As for if it is clear (to him) that he ate or drank after Fajr appeared visibly without any doubt about it, then upon him is Qadaa (i.e. he has to make up for the fast on another day). Likewise, if he breaks the (fast) thinking that the sun has set, but then it became clear (to him) that it has not set, then upon him is Qadaa” ( i.e. he has to make up for the fast on another day).
Fath al-Rab al-Wadood Fil Fataawa wa al-Risaail wal Rudood 323 / 1