use diag_tickTime instead of sleep to make timing more reliable