FR 3181 then FR 333 at Barcelona
Rome → Barcelona → Gdansk
Timetable, Barcelona time
13:40FR 3181 from Rome at the gate
10:00FR 333 to Gdansk leaves the gate
20 h 20 apart on the timetable, overnight
FR 333 leaves 20 h 20 after FR 3181 arrives on the timetable: more than half a day, so not a connection we count.