Fix some unit testing problems
Unit tests fixes

Unit tests passed on CentOS 6.5 with this fixes
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