To calculate time between two DateTime attributes you can use the Between Date Function calls: https://docs.mendix.com/refguide7/between-date-function-calls#hoursbetween
To calculate the distance between two points i guess you should use a java action. There used to be one in this appstoremodule: https://appstore.home.mendix.com/link/app/1822/