IB 5389 then IB 416 at Barcelona
Bari → Barcelona → Madrid
Timetable, Barcelona time
23:20IB 5389 from Bari at the gatealso LL 5389, VY 6113
17:00IB 416 to Madrid leaves the gatealso IB 416S, LL 3016, VY 5068, QR 6587, BA 7083, CZ 7325, AA 8732
17 h 40 apart on the timetable, overnight
IB 416 leaves 17 h 40 after IB 5389 arrives on the timetable: more than half a day, so not a connection we count.