Not that there is anything wrong with how you are putting the numbers together, but if you’d like to prepare for OH 3.0 (no Joda), you could use ZoneDateTime and ChronoUnit.
import java.time.temporal.ChronoUnit
...
val prevOnState = TTNseawTemp_LastUpdate.getStateAs(DateTimeType).zonedDateTime.until((new DateTimeType).zonedDateTime, ChronoUnit.MINUTES)