Almost fixed nextActionTime calculation