Calculate elapsed time without unix timestamp

Your example uses signed arithmetic, that is why it fails. Unsigned arithmetic will wrap cleanly if it's coded with subtraction.

Anyway, the Arduino time library uses unsigned time_t values, and so does not expire in 2036 (it just gave up the ability to deal with dates prior to 1970-ish). It's sometime after 2100, I forget the exact date.