Taking the time difference between 2 rfid with ds3231

i have car park project with arduino mega. i use 2 rfids. First RFID (mfrc522) controls entry barrier. second RFID contols exit barier. i use an rfid-controlled servo motors. i can get time on serial with rtc(ds3231).
But i need to taking time difference.
for example car is entry time 21:31:37. and this car exit time 21:33:42. i need to taking time difference on minute. the car was inside for 2 minutes. I have to charge you accordingly. how can i get this time. help me pls

The classic way is to convert all your times to the number of seconds past midnight. And take care of the case where one time is just before midnight and the second time is just after.


I don't know how to design the code.