Correctly calculate ms