Assigning the break activity between the driving time of 2 activities

Hello All,

I have a use case wherein I am needed to assign a break activity after a certain number of hours of continuous driving. For now, it gets assigned either right after the first activity or right before the 2nd activity.
For example -
if a vehicle takes 5 hours of driving time from location A to location B, so lets say the driver started at 07:00 and the driver’s shift ends at 10:00 and starts again at 20:00 then ideally the algorithm should break the driving time of 5 hours into 2 activities 3 hours of driving before 10:00 and 2 hours driving after 20:00. However, it doesn’t work like this as of now. It assigns the 5 hour driving time straight as one activity at 20:00, wasting 3 hours of driver’s shift time before 10:00.

Need to understand what can be done here or if there’s something wrong I am doing here.

Thanks in advance.