Per Diem starts when you check in for a trip and ends at the completion of a trip.
For example I am on a 3 day trip which checked in at 5:15am on 1 May(The first leg of the trip pushed back at 6:00am). It is scheduled to finish at 11:30am(15 min after arrival of the last leg) on 3 May, for a total TAFB (Time Away From Base) of 54:15.
By the way, this trip pays 15:45, and has a duty time of 32:00.