TRQ-2845: Fixed tmp_time math in mom_main main loop

Fixed tmp_time math
Moved the logic to a function
Wrote a unit test

Conflicts:

	src/resmom/test/mom_main/test_mom_main.c