FR 2540 then FR 7071 at Madrid
Bucharest → Madrid → Gdansk
Timetable, Madrid time
13:55FR 2540 from Bucharest at the gate
10:15FR 7071 to Gdansk leaves the gate
20 h 20 apart on the timetable, overnight
FR 7071 leaves 20 h 20 after FR 2540 arrives on the timetable: more than half a day, so not a connection we count.