Add testing of period end_time vs max_end_time.

To match the current behaviour. Mostly added as I'm about to change
how delays are calculated and want to be sure I don't break this.
Also to record how this works.

Change-Id: Id4528ba3a6824e184dd9fd0682ef52ff7df27d1f
Move calculation of the start/end times outside loop.

These don't change per iteration, and it's far more likely that there's
more than one arena than none in a match. It's therefore probaly faster
to only work these out once, and it's somewhat clearer too.

Change-Id: I2bc1101e475a0daae5a768e490be2f1973b39905
Remove redundant imports.

Spotted by pyflakes.

Change-Id: I6d6ee86cf10894428d4e673b540d1c48d7ce378c
Remove unused variable.

Spotted by pyflakes.

Change-Id: Ic92daa0f0aae86d80b1e67ea9905e43133e62519