Fix PeriodicTask interval sleep calculation