Adjusting for time of infection or positive test when estimating the risk of a post-infection outcome in an epidemic