fix next sync time not being calculated correctly in some cases
Implement alarm method