Infection remains a significant and common complication after joint replacement and there is debate about which contributing factors are important. Few studies have investigated the effect of the operating time on infection. We collected data prospectively from 5277 hip and knee replacements which included the type of procedure, the operating time, the use of drains, the operating theatre, surgeon, age and gender. In a subgroup of 3449 knee replacements further analysis was carried out using the tourniquet time in place of the operating time. These variables were assessed by the use of generalised linear modelling against superficial, deep or joint-space post-operative infection as defined by the Australian Surgical-Site Infection criteria. The overall infection rate was 0.98%. In the replacement data set both male gender (z = 3.097, p = 0.00195) and prolonged operating time (z = 4.325, p < 0.001) were predictive of infection. In the knee subgroup male gender (z = 2.250, p = 0.02447), a longer tourniquet time (z = 2.867, p = 0.00414) and total knee replacement (versus unicompartmental knee replacement) (z = -2.052, p = 0.0420) were predictive of infection. These findings support the view that a prolonged operating time and male gender are associated with an increased incidence of infection. Steps to minimise intra-operative delay should be instigated, and care should be exercised when introducing measures which prolong the duration of joint replacement.