Fixed error in sample time calculation