Updated metric calculation to fix time after ts