Fixed algorithm for calculating seconds until alarm