The sun was eclipsed while we were with the Messenger of Allah ﷺ in Medina. He came out in alarm, dragging his garment, and prayed two long units of prayer. He finished just as the eclipse ended. He praised Allah and glorified Him, then said, "The sun and the moon are two of the signs of Allah. They are not eclipsed for the death or birth of anyone. So when you see anything of that, pray as you would the most recent obligatory prayer you have prayed."
و أخبرنا إبراهيم بن يعقوب قال حدثنا عمرو بن عاصم أن جده عبيد الله بن الوازع حدثه قال حدثنا أيوب السختياني عن أبي قلابة
كسفت الشمس ونحن إذ ذاك مع رسول الله ﷺ بالمدينة فخرج فزعا يجر ثوبه فصلى ركعتين أطالهما فوافق انصرافه انجلاء الشمس فحمد الله وأثنى عليه ثم قال إن الشمس والقمر آيتان من آيات الله وإنهما لا ينكسفان لموت أحد ولا لحياته فإذا رأيتم من ذلك شيئا فصلوا كأحدث صلاة مكتوبة صليتموها
[Its chain is daif] Abu Dawud narrated it in the Book of Prayer, Chapter of one who said four units, hadith no. 1185, from the hadith of Ayub, with this same wording. It is also in Sunan al-Kubra, hadith no. 1871. Bayhaqi said in 3/334, "This one too, Abu Qilaba did not hear it from Qabisa. Rather, he related it from a man, from Qabisa."