The Anderson-Gill (AG) model is commonly used for analyzing recurrent event data under the assumption that the hazard ratio is constant over time. We extended the AG framework by relaxing the proportional hazards assumption and modeled a time-dependent hazard ratio (TDHR) as a function of exposure-time via regression cubic B-splines. In particular, multiplicative terms between the spline basis functions and treatment are included as time-dependent covariates in the AG model. To test whether the TDHR is a meaningful deviation from the constant effect, we computed a likelihood ratio test from the difference in log-likelihoods of the traditional AG model and the extended AG model. We used the bootstrap method to obtain the 95% confidence bands around the TDHR and the cumulative hazards for individual treatment groups by sampling with replacement, computing model estimates, and repeating 100 times. To illustrate an application of this approach, we evaluated the time-dependent hazard ratio of infections comparing two multiple sclerosis immunosuppressing therapies: anti-VLA4 (TYS) and B-cell depleting (BCELL) agents.