you can use the hoursBetween() function, which will help you to get the number of hours between start and end time, and on the base of that, you ccan write your own logic of adding lines.
Let me know, if you hae any issues,
Hope it helps!!
You can take a look at calculating the difference between two dates https://docs.mendix.com/refguide9/between-date-function-calls/
or the other way around look at adding or subtracting time to/from a date
But the second part of your question I don't really get. Adding a related record is not difficult, but what date are you trying to change? Be aware that if time elapses the difference between dates becomes larger as well and depending on if you want to display the actual/current difference you might want to look in using a calculated attribute. To be able to execute logic on a regular basis (eg check every hour if the '24 hours' passed for a record and then create/update records) you can use scheduled events.
Hope this helps