This seems like a bad idea.  It might have been much longer than the sampling rate in some cases.  probably get xTaskGetTickCount() again